Multiple jobs writing to the same sequential file



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Multiple jobs writing to the same sequential file

Postby t_bt2 » Sat Jan 25, 2020 6:42 am

Hello Everyone.

I have a three COBOL programs and want them to writing to a single sequential file simultaneously, as the programs run at the same time.

Is this possible? If so how can I accomplish this?

Thanks in advance for any help.
t_bt2
 
Posts: 2
Joined: Sat Jan 25, 2020 6:23 am
Has thanked: 0 time
Been thanked: 0 time

Re: Multiple jobs writing to the same sequential file

Postby steve-myers » Sat Jan 25, 2020 8:56 am

Yes, it is possible, but ... the odds are the output will be useless, for several reasons.
  1. There is no mechanism in z/OS data management to ensure the records will be interleaved in the manner I think you expect.
  2. In the event the output is directed to a data set on magnetic tape, the second and subsequent programs that attempt to open the data set while the first program has the data set open will be abnormally terminated.
  3. The end of data for the data set is established by the last program that closes the data set, even if other programs have sent more data to the data set.
  4. Because of the way z/OS writes data to disks, the slower program may well over write data that faster programs have written to the disk.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Multiple jobs writing to the same sequential file

Postby willy jensen » Sat Jan 25, 2020 12:53 pm

Possible, yes, but complicated.
In assembler I would do something like
test/wait for some agreed-upon resource name then enqueue the resource
open the dataset with the EXTEND option (this allows allocation with disp=shr and still act as if disp=mod was specified)
write
close
dequeue the resource
You need the open and close to flush buffers.
This will be horribly inefficient, but should be safe. And I have no idea if enqueue/dequeue is avaiable for a COBOL program or if the EXTEND option can be used in a COBOL OPEN.
I will much recommend that the programs write to seperate datasets, with a timestamp so that they can be merged afterwards.
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: Multiple jobs writing to the same sequential file

Postby t_bt2 » Sat Jan 25, 2020 2:13 pm

Thank you both for your replies.

It sounds like having the the three programs write to the same sequential file at the same time is too risky. I'll go with the notion of writing to respective files then add an end of night step that merges the the files at the end of night..
t_bt2
 
Posts: 2
Joined: Sat Jan 25, 2020 6:23 am
Has thanked: 0 time
Been thanked: 0 time

Re: Multiple jobs writing to the same sequential file

Postby chaat » Sat Feb 15, 2020 4:52 am

If you have IBM BatchPipes installed, you can have multiple jobs write to the same named pipe and a single SORT COPY job reading from that named pipe and writing to an output file. I've not used BatchPipes recently so best to check the documentation.

Chuck Haatvedt
chaat
 
Posts: 27
Joined: Sun Aug 16, 2009 11:07 pm
Location: St. Cloud, Minnesota
Has thanked: 0 time
Been thanked: 1 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post