Dynamic call in COBOL



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Dynamic call in COBOL

Postby Priyadharshini » Thu Feb 25, 2010 3:52 pm

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
Priyadharshini
 
Posts: 6
Joined: Wed Feb 24, 2010 10:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamic call in COBOL

Postby MrSpock » Thu Feb 25, 2010 5:01 pm

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.
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: Dynamic call in COBOL

Postby dick scherrer » Fri Feb 26, 2010 12:53 am

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?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Dynamic call in COBOL

Postby Priyadharshini » Fri Feb 26, 2010 12:08 pm

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
Priyadharshini
 
Posts: 6
Joined: Wed Feb 24, 2010 10:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamic call in COBOL

Postby Priyadharshini » Fri Feb 26, 2010 1:18 pm

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
Priyadharshini
 
Posts: 6
Joined: Wed Feb 24, 2010 10:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamic call in COBOL

Postby ctrevino » Fri Feb 26, 2010 10:14 pm

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?
Christy T.


Wherever you go, there you are - Buckaroo Banzai
ctrevino
 
Posts: 62
Joined: Tue Feb 23, 2010 1:23 am
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamic call in COBOL

Postby Priyadharshini » Sun Feb 28, 2010 9:41 pm

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
Priyadharshini
 
Posts: 6
Joined: Wed Feb 24, 2010 10:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamic call in COBOL

Postby dick scherrer » Sun Feb 28, 2010 10:53 pm

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Dynamic call in COBOL

Postby Priyadharshini » Mon Mar 01, 2010 7:45 pm

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
Priyadharshini
 
Posts: 6
Joined: Wed Feb 24, 2010 10:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Dynamic call in COBOL

Postby ctrevino » Mon Mar 01, 2010 8:13 pm

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
Christy T.


Wherever you go, there you are - Buckaroo Banzai
ctrevino
 
Posts: 62
Joined: Tue Feb 23, 2010 1:23 am
Has thanked: 0 time
Been thanked: 0 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post