MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reading a GDG in FIFO order ?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
singhnarender79
Beginner


Joined: 24 Dec 2002
Posts: 32
Topics: 6
Location: U.K

PostPosted: Wed Apr 21, 2004 9:29 am    Post subject: Reading a GDG in FIFO order ? Reply with quote

Hi

I have a strange requirement here. I have a cobol program that needs to read in all the members of a GDG.

Initially i went about by giving the GDG base as the ddname in the proc, it concatenates the GDG members but then the default order is LIFO. But given the processing logic of my cobol program i want this concatenation to happen in FIFO order.

Now i read an earlier post about reading GDG's in reverse order. They suggested 2 approaches. Approach 1 was to run a ReXX code, which is fine but then i wont be allowed to run ReXX codes on my mainframe installation (dont ask why ?). Approach 2 was to use sort and assign sequence no's and then sort in the descending order and finally removing the sequence no's. Now even this has a glitch. Let me just give an overview of how the data in the GDG member looks like. It basically consists of a header followed by detail records and then the trailer record. Now if i go by the sort approach, i get the data in FIFO order but it comes in a trailer record followed by detail records and then the header record which is not acceptable. Hope iam clear here ?

Now all i wanna know is if there is any other approach (plz try and confine to cobol and jcl) to do this ?

With regards
Naren
_________________
"Hold fast to dreams, for if dreams die, life is a broken winged bird that cannot fly."

-- Langston Hughes
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Apr 21, 2004 10:37 am    Post subject: Reply with quote

Naren,

The simplest way is to generate the cobol pgm ddname with the concatenated list of gdg versions.

The following DFSORT Jcl will give you the desired results.

A brief explanation of the job. The first step gets all the gdg version names using LISTCAT command

STEP0200 takes in the listcat input and creates 2 files. File T1 will have the first gdg version attached to the pgm dd name.
ie.
Code:

//PGMDDNAM DD DISP=SHR,DSN=USERID.GDGBASE.G1630V00


File t2 will have all the later versions of the GDG as part of concatenation.

Code:

//         DD DISP=SHR,DSN=USERID.GDGBASE.G1631V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1632V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1633V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1634V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1635V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1636V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1637V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1638V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1639V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1640V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1641V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1642V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1643V00
//         DD DISP=SHR,DSN=USERID.GDGBASE.G1644V00


Now the step0300 will submit the actual cobol pgm job via intrdr.

Code:

//STEP0100 EXEC PGM=IKJEFT01                                 
//SYSTSPRT DD DSN=&L,                                       
//            DISP=(,PASS),                                 
//            SPACE=(CYL,(25,25),RLSE),                     
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)             
//SYSTSIN  DD *                                             
  LISTCAT ENT('USERID.GDGBASE') NAME           
//*                                                         
//STEP0200 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN=&L,DISP=(OLD,PASS)                         
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)   
//T2       DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)   
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INCLUDE COND=(4,7,CH,EQ,C'NONVSAM')                       
  OUTFIL FNAMES=T1,ENDREC=1,                                 
  OUTREC=(C'//PGMDDNAM DD DISP=SHR,DSN=',17,44,80:X)         
  OUTFIL FNAMES=T2,STARTREC=2,                               
  OUTREC=(C'//         DD DISP=SHR,DSN=',17,44,80:X)         
//*                                                         
//STEP0300 EXEC  PGM=SORT                       
//SYSOUT   DD SYSOUT=*                           
//SORTOUT  DD SYSOUT=*                           
//SORTIN   DD DATA,DLM=$$                       
//TIDXXXXA JOB 'PGM',                           
//             CLASS=A,                         
//             MSGCLASS=Y,                       
//             MSGLEVEL=(1,1),                   
//             NOTIFY=TID                       
//*                                             
//STEP0100 EXEC  PGM=COBPGM                     
//SYSOUT   DD SYSOUT=*                           
//SYSPRINT DD SYSOUT=*                           
....add you other input/output file if any
//OUTPUT   DD DSN=XYZ.WVU.PQRS.ABCD,             
//            DISP=(NEW,CATLG,DELETE),           
//            UNIT=SYSDA,                       
//            SPACE=(CYL,(X,Y),RLSE)             
$$                                               
//         DD DSN=&T1,DISP=(OLD,PASS)           
//         DD DSN=&T2,DISP=(OLD,PASS)           
//SYSIN    DD *                                 
  SORT FIELDS=COPY                               
//*                                             


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
singhnarender79
Beginner


Joined: 24 Dec 2002
Posts: 32
Topics: 6
Location: U.K

PostPosted: Thu Apr 22, 2004 5:24 am    Post subject: Reply with quote

Hi Kolusu / Ravi

To sum it up in 1 word, the solution was AWESOME...... Very Happy
It was exactly what i was looking for.

Thanks a lot for your assistance.

With regards
Naren
_________________
"Hold fast to dreams, for if dreams die, life is a broken winged bird that cannot fly."

-- Langston Hughes
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group