Page 1 of 2

Dynamic call in COBOL

PostPosted: Thu Feb 25, 2010 3:52 pm
by Priyadharshini
A FB file has n number of GDG generation names. And file name length is same(say 32 of length).

Records in file are like this:
XXXXXX.TEST.BSALLOC.ABSA.G0001V00 --> GDG file
XXXXXX.TEST.BSALLOC.ABSA.G0002V00
XXXXXX.TEST.BSALLOC.BBBB.G0001V00
XXXXXX.TEST.BSALLOC.BBBB.G0002V00

I need to read these GDG files and copy the contents of each and every file into new output file.
The thing is LRECL of these files are not same and so i have to keep the max possible LRECL of these files as LRECL of output file.

Anyone let me know how this can be done in COBOL.

Thanks
Priya

Re: Dynamic call in COBOL

PostPosted: Thu Feb 25, 2010 5:01 pm
by MrSpock
Are the datasets in the list all FB, all VB, or are they a mixture?

Here's what I know, though I'm not a COBOL programmer:

If all the datasets are VB, then you can read them all from a single File-Definition (FD) entry. You'll just have to dynamically allocate each dataset to that one DD name, and process accordingly.

If all the datasets are FB, then you'll have to know what the record lengths are, and you'll need a File-Definition (FD) entry for each possible LRECL. You'll have to dynamically allocte each dataset to the proper DD that relates to the proper record length.

To be honest, what you're proposing seems like it's much better suited to using SORT (or REXX or CLIST) instead of writing your own code in COBOL.

Re: Dynamic call in COBOL

PostPosted: Fri Feb 26, 2010 12:53 am
by dick scherrer
Hello,

Why do you not want the new files to have the same attributes as the original files?

If the goal is to make a copy, why use cobol?

Re: Dynamic call in COBOL

PostPosted: Fri Feb 26, 2010 12:08 pm
by Priyadharshini
Hi,

Thanks for your reply dick and spock.
Even i thought before the same of doing it in JCL itself.
But i am not sure how i can read the dataset in file dynamically through JCL and so came up for COBOL dynamic call.

If it is possible to do in JCL itself it is well and good. I am new to REXX and CLIST.
Can you please suggest me how i can do that in REXX or some links to learn about REXX.

Thanks
Priya

Re: Dynamic call in COBOL

PostPosted: Fri Feb 26, 2010 1:18 pm
by Priyadharshini
Hi,

The input files are all FB and not VB. Sorry, in my previous post i told the output file should be of max LRECL of input file.
But output file LRECL is known and it is 255,FB.

My requirement is to do it in COBOL program. But if it is possible to do in simple DFSORT let me know.

Thanks
Priya

Re: Dynamic call in COBOL

PostPosted: Fri Feb 26, 2010 10:14 pm
by ctrevino
Do you know what the names of the output file are going to be? Are the names static or do you need to create the names on the fly?

Re: Dynamic call in COBOL

PostPosted: Sun Feb 28, 2010 9:41 pm
by Priyadharshini
Hi,

Thanks. There is only one output file with LRECL of 255. I knew the output file name it is coded in program and JCL. It is going to be static.


Thanks
Priya

Re: Dynamic call in COBOL

PostPosted: Sun Feb 28, 2010 10:53 pm
by dick scherrer
Hello,

Why is the goal to copy records of unlike formats into a common file. This "pile of stuff" would not be very useful.

How would this "combined file" be used?

If we understood what you really want to accomplish (other than make some kind of copy) we might be able to offer more useful suggestions.

Re: Dynamic call in COBOL

PostPosted: Mon Mar 01, 2010 7:45 pm
by Priyadharshini
Hi Dick,

I will elaborate little more my requirement.

My input file has list of GDG versions in it. These GDG's are got from different sources through NDM. I need to read each and every GDG and copy their records into Ist output file which is of length 255. I just need to copy the records from these GDG's. The LRECLs of these GDGs are not same as i mentioned before.

Apart from this
1. I should make a note of number of records copied/present in each and every GDG separately.
2. Create IInd o/p file which has the list of GDG names whose records are successfully copied into Ist o/p file.
3. After 2nd step, i need to delete the GDG versions which are successfully copied into Ist o/p file.

Later, the Ist o/p file is used in some processing. This is my reqiurement as such.
Now please let me know how this can be done.

Thanks
Priya

Re: Dynamic call in COBOL

PostPosted: Mon Mar 01, 2010 8:13 pm
by ctrevino
Priya,
You can try this, just concatenate your datasets in the SORTIN statement.
//S4SORT EXEC PGM=SORT                                         
//SORTIN   DD DSN=INPUT.VARIABLE.FILE,DISP=SHR     <=Variable input           
//SORTOUT  DD DSN=OUTPUT.FIXED.FILE,   <===== Fixed output
//          DISP=(NEW,CATLG,DELETE),                           
//          UNIT=(SYSDA),SPACE=(TRK,(50,15),RLSE),       
//          DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920)               
//SYSOUT   DD SYSOUT=*                                         
//SYSIN    DD *                                                 
 INREC FIELDS=(1:1,4,                                           
               6:6,74)                                         
 SORT FIELDS=(62,8,CH,A)                                       
 OUTFIL OUTREC=(1:1,4,                                         
              6:6,74,                                           
             80:C' '),CONVERT 


HTH,
Christy