0

I want my JAVA application to communicate with Mainframe. I want mainframe to send the data in a text file to MQ and from MQ I can read it.

Currently our Mainframe developer is able to send everything in a single line. He sends it like a big message and I want the content to be sent in a text file. Is that possible? Does Mainframe support file sending to MQ?

user3262365
  • 75
  • 1
  • 10
  • to my knowledge you cannot send a file to a queue. Each record in the queue corresponds to a copybook layout. So a block of data that is sub divided into smaller pieces represented by the copybook. What you could do is have you JAVA program map the input using the copybook layout that the mainframe program used to create it. This Stackover post recommends using Jrecord: http://stackoverflow.com/questions/802122/reading-cobol-datastructures-from-java – SaggingRufus Jan 05 '17 at 18:08
  • No concept of a file on a queue, but you can put the contents on the queue as a single message. Your mainframe developer knows how to do it. You can do it in Java, too. – duffymo Jan 05 '17 at 18:23
  • 1
    This isn't a question of what the mainframe supports, it's a question of what MQ supports. As duffymo indicates, MQ has no concept of files, only messages. – cschneid Jan 05 '17 at 22:14

2 Answers2

2

As of MQ 7.5, MQ contains 'Managed File Transfer' (MFT) function, which will allow the transmission of files from Mainframe to other platforms and back again.

Essentially you create a Managed File Transfer agent on each host which you would like to send/receive files.

There's a good introduction to MFT in the knowledge center here if you wish to read further on the subject: http://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.wmqfte.doc/wmqfte_intro.htm

Tim McCormick
  • 956
  • 4
  • 7
2

This is no big deal - I've been doing this for 20 years.

Clearly, you have limited knowledge of MQ and z/OS (mainframe). A file is a file is a file whether it is on a PC or Unix/Linux or the mainframe.

As other people have pointed out, MQ deals with messages and not files but you can put a file as a message. MQ treats the message data (aka payload) as a blob. The message data can be an XML file or PNG or PDF or simple text, etc.

The difference between a file on a given platform is the termination of a line (aka record). On a PC it is CRLF, on Unix/Linux it is LF and Mac OS X it is CR. The mainframe does not have that concept. On the mainframe, you have either fixed record length or variable record length files (aka datasets).

If the mainframe program is loading a fixed record length file then life is very straight forward. Simply ask the mainframe developer what the record length is (i.e. 80) then parse the message data in chunks. If it is variable length record then ask the mainframe developer to insert a CR (x'0D') after each record then when your application receives it, you will know where the termination of a line is.

Roger
  • 7,062
  • 13
  • 20