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 

How To Disintegrate A File thru JCL
Goto page 1, 2  Next
 
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
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Mon Jan 12, 2004 5:48 pm    Post subject: How To Disintegrate A File thru JCL Reply with quote

Hi All !

I need to know which Utilities can help achieve the following and some specifics as how to in a JCL .

I have a Input File of Fixed Record Length of 480. Need to create a New Output File where the Record Length would now be 80 bytes ! Basically each 480 byte Input Record to result in 6 Output Recds of 80 bytes each.

I am aware this can be achieved thru a Program ..however ...if there is an alternate method available I would prefer not to code a Program for it.

Thanks a ton !
Vini


Last edited by vini on Mon Jan 12, 2004 6:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Jan 12, 2004 6:12 pm    Post subject: Reply with quote

Vini,

The following JCL will give you the desired results.
Code:

//STEP0100  EXEC  PGM=SORT                           
//SYSOUT    DD SYSOUT=*                               
//SORTIN    DD DSN=YOUR INPUT 480 BYTE FILE,
//             DISP=SHR
//FIRST     DD DSN=YOUR 1-80 BYTES FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//*
//SECOND     DD DSN=YOUR 80-160 BYTES FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//*
//THIRD     DD DSN=YOUR 160-240 BYTES FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//*
//FOURTH    DD DSN=YOUR 240-320 BYTES FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//*
//FIFTH     DD DSN=YOUR 320-400 BYTES FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//*
//SIXTH     DD DSN=YOUR 400-480 BYTES FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//*             
//SYSIN     DD *
  SORT FIELDS=COPY
  OUTFIL FNAMES=FIRST,OUTREC=(1,80)
  OUTFIL FNAMES=SECOND,OUTREC=(81,80)
  OUTFIL FNAMES=THIRD,OUTREC=(161,80)
  OUTFIL FNAMES=FOURTH,OUTREC=(241,80)
  OUTFIL FNAMES=FIFTH,OUTREC=(321,80)
  OUTFIL FNAMES=SIXTH,OUTREC=(401,80)
/*


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
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Mon Jan 12, 2004 6:28 pm    Post subject: Reply with quote

Kolusu,

I did not understand the following steps as all I have is ONE FILE as Input and of Length 480. How do I make these FIRST to SIXTH files from this ONE File OR are you sayin the SORTIN File would be same as all these ??? Pls. explain and bear with me as I am not very familiar with JCLs.

//FIRST DD DSN=YOUR 1-80 BYTES FILE
//SECOND DD DSN=YOUR 80-160 BYTES FILE,
...
//SIXTH ....

Thanks.
Vini
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Jan 12, 2004 6:40 pm    Post subject: Reply with quote

vini,

As you already noticed that we just have one input file and sort utility reads this file and splits the record into 6 different files. Look at the sysin statements

Code:

OUTFIL FNAMES=FIRST,OUTREC=(1,80)


Which means that copy the input file to output file with ddname FIRST and the outrec tells to copy bytes starting from 1 for a length of 80 bytes. simlarly the second ,third...

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
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Jan 12, 2004 7:03 pm    Post subject: Reply with quote

Kolusu,

I think Vini wants ONE output file with each large record split into 6 smaller output records, not 6 output files.

Vini,

If that's what you want, you can use the following DFSORT job to do this:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...   LRECL=480 input file
//SORTOUT DD DSN=...   LRECL=80 output file
//SYSIN DD *
  OPTION COPY
  OUTFIL OUTREC=(1,80,/,81,80,/,161,80,/,241,80,/,321,80,/,401,80)
/*


/ tells DFSORT to start a new line.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Mon Jan 12, 2004 7:19 pm    Post subject: Reply with quote

kolusu ,
I executed the following JCL .
However ..where would the OUTPUT File get created .. .. what steps am I missing to complete this JCL to get the actual output in a DS i.e ? .. If all this sounds DUMB pls. bear with me as am a beginner. Also my input file will potentially have multiple records of length 480.
Code:

//DISINTEG JOB (JOO,711),'DISINTEG   ',TIME=5,PRTY=13,                         
//  NOTIFY=WHUK90,REGION=0M,PERFORM=10,MSGCLASS=T                               
//**********************************************************************       
//STEP0100  EXEC  PGM=SORT                                                     
//SYSOUT    DD SYSOUT=*                                                         
//SORTIN    DD DSN=WLFA.ASX810FA.WA01PS.G0145V00,                               
//             DISP=SHR                                                         
//FIRST     DD DSN=&&DSN1,                                                     
//             DISP=(,PASS),                                                   
//             UNIT=SYSDA,                                                     
//             SPACE=(CYL,(1,1),RLSE)                                           
//*                                                                             
//SECOND     DD DSN=&&DSN2,                                                     
//             DISP=(,PASS),                                                   
//             UNIT=SYSDA,                                                     
//             SPACE=(CYL,(1,1),RLSE)                                           
//*                                                                             
//THIRD     DD DSN=&&DSN3,                                                     
//             DISP=(,PASS),                                                   
//             UNIT=SYSDA,                                                     
//             SPACE=(CYL,(1,1),RLSE)                                           
//*                                                                             
//FOURTH    DD DSN=&&DSN4,                                                     
//             DISP=(,PASS),                                                   
//             UNIT=SYSDA,                                                     
//             SPACE=(CYL,(1,1),RLSE)                                           
//*                                                                             
//FIFTH     DD DSN=&&DSN5,                                                     
//             DISP=(,PASS),                                                   
//             UNIT=SYSDA,                                                     
//             SPACE=(CYL,(1,1),RLSE)                                           
//*                                                                             
//SIXTH     DD DSN=&&DSN6,                                                     
//             DISP=(,PASS),                                                   
//             UNIT=SYSDA,                                                     
//             SPACE=(CYL,(1,1),RLSE)                                           
//*                                                                             
//SYSIN     DD *                                                               
  SORT FIELDS=COPY                                                             
  OUTFIL FNAMES=FIRST,OUTREC=(1,80)                                             
  OUTFIL FNAMES=SECOND,OUTREC=(81,80)                                           
  OUTFIL FNAMES=THIRD,OUTREC=(161,80)                                           
  OUTFIL FNAMES=FOURTH,OUTREC=(241,80)                                         
  OUTFIL FNAMES=FIFTH,OUTREC=(321,80)                                           
  OUTFIL FNAMES=SIXTH,OUTREC=(401,80)                                           
/*                                                                             
//*                                     


Thnks
vini
Back to top
View user's profile Send private message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Mon Jan 12, 2004 7:40 pm    Post subject: Reply with quote

Frank ,

Thanks ...the DFSORT did work !

How can I achieve the Reverse now ...meaning to ask ...my Input now is of 80 and need Output of 480 ...i.e 6 records of Input clubbed into ONE Output record . Is this also possible using DFSORT in some way ??? Pls. let me know.


vini
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Jan 12, 2004 8:32 pm    Post subject: Reply with quote

Vini,

DFSORT does NOT have any built-in function to go from six 80 byte records to one 480 byte record. I'm on my way out, so I can't post more at the moment. Maybe Kolusu or somebody else knows a trick for this (playing around with the BLKSIZE, maybe?). Of course, you could always do it with an E15 exit.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jan 13, 2004 7:17 am    Post subject: Reply with quote

Vini,
I sincerely apolozise for mis-intrepreting your question. As shown by frank you can use the "/" to split 1 record into 'n' number of records. Now for reversing i.e combining 6 records into 1 single record involves a trick. Usually with sort products you don't have to specify the DCB Parameters. sort automatically calculates it from the sortin or inrec or outrec fields.

Now the trick to create the split file with a BLKSIZE which is a EVEN multiple of the LRECL.In this case I used 480. Now in the second step we override the LRECL to 480 even though the file lrecl is only 80 bytes. The LRECL=480 on the DD statement overrides the LRECL=80 in the DSCB, so the data set is treated as if it has LRECL=480 and adjacent 80 bytes records are read as one record.

Personally I do not like the idea of messing around with the LRECL/BLKSIZE this way. The following JCl will give you the desired results.

Code:

//********************************************************************
//* THIS STEP WILL SPLIT THE INPUT RECORD INTO 6 RECORDS EACH WITH   *
//* 80 BYTES IN LENGTH.                                              *
//********************************************************************
//STEP0100  EXEC  PGM=SORT                                             
//SYSOUT    DD SYSOUT=*                                               
//SORTIN    DD DSN=YOUR 480 BYTES INPUT FILE,
//             DISP=SHR                                               
//SORTOUT   DD DSN=YOUR OUTPUT FILE SPLIT INTO 6 RECORDS,
//             DISP=(NEW,CATLG,DELETE),                               
//             UNIT=SYSDA,                                             
//             SPACE=(CYL,(X,Y),RLSE),                                 
//             DCB=(LRECL=80,RECFM=FB,BLKSIZE=480)                     
//SYSIN     DD    *                                                   
  SORT FIELDS=COPY                                                     
  OUTFIL OUTREC=(1,80,/,81,80,/,161,80,/,241,80,/,321,80,/,401,80)
//*   
//********************************************************************
//* THIS STEP WILL COMBINE 6 RECORDS INTO A SINGLE RECORD BY OVER-   *
//* RIDING THE LRECL ON THE SORTIN DATASET.                          *
//********************************************************************
//STEP0200  EXEC  PGM=SORT                                           
//SYSOUT    DD SYSOUT=*                                               
//SORTIN    DD DSN=YOUR INPUT FILE WHICH IS SPLIT INTO 6 RECORDS,                 
//             DISP=SHR,LRECL=480                                     
//SORTOUT   DD DSN=YOUR OUTPUT FILE WHICH COMBINES 6 RECORDS INTO ONE,
//             DISP=(NEW,CATLG,DELETE),                               
//             UNIT=SYSDA,                                           
//             SPACE=(CYL,(X,Y),RLSE)                                 
//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
Mike Chantrey
Intermediate


Joined: 10 Sep 2003
Posts: 234
Topics: 1
Location: Wansford

PostPosted: Tue Jan 13, 2004 7:19 am    Post subject: Reply with quote

Note to kolusu: I was writing the following before I saw your post.
When you state 'an even multiple of the blocksize' do you mean this or do you actually mean 'an exact multiple'. I don't understand why the mutiple shouldn't be odd (e.g. 57 * 480 as opposed to 58 * 480)


You can do this with IEBGENER, DFSORT, FILEAID, etc..
All you need to do is:
1/ When you create it, make sure the blocksize of your '80 character' dataset is a multiple of 480 (do not use system determined blocksize) e.g. BLKSIZE=27840 for 3390 is OK.
2/ Simply put an LRECL=480 override on your input dataset and copy it to the 480 character output dataset.
e.g.
Code:

//RUN EXEC PGM=IEBGENER                           
//SYSPRINT DD SYSOUT=*                           
//SYSUT1 DD DSN=@USER1.T6X80,DISP=OLD,LRECL=480   
//SYSUT2 DD DSN=@USER1.T1X480,DISP=OLD           
//SYSIN DD DUMMY                                 


SYSUT1 is the dataset with the groups of 6 80 character records and SYSUT2 is the resulting output dataset with them joined back into 480 character records.

DFSORT can do the same with 'MERGE FIELDS=COPY' or FILEAID with its COPY function.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jan 13, 2004 7:36 am    Post subject: Reply with quote

Mike,

I remember getting an S013 abend when the BLKSIZE is an ODD mulitple of the LRECL.in this case the odd multiple of blksize will result in a abend as we are combining an even number(6) records into a single record. I cannot test it right now but may be some one can test with an odd multiple of the blksize.

Thanks,

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


Joined: 10 Sep 2003
Posts: 234
Topics: 1
Location: Wansford

PostPosted: Tue Jan 13, 2004 8:21 am    Post subject: Reply with quote

Kolusu,
I have tested with:
1500 x 80 char records
blocksize=27360 (= 57 * 480)
with IEBGENER, DFSORT and FILEAID
and in each case it works fine, with 250 correctly joined records created.
I have never come across the problem you are describing; as per above I understood that the only requirement is that the overiding LRECL is an exact (odd or even) multiple of the blocksize. Perhaps this was a problem a number of years ago which does not apply now?
Back to top
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Fri Apr 14, 2006 4:03 am    Post subject: Reply with quote

Hi,

Would you please post the solution with File-Aid.

TIA.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Apr 14, 2006 5:35 am    Post subject: Reply with quote

ranga_subham,

For which one ? to split the file into 6 different files or to merge them back?

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


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Fri Apr 14, 2006 10:47 pm    Post subject: Reply with quote

Both of them in fact........ Mr. Green
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
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
Goto page 1, 2  Next
Page 1 of 2

 
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