View previous topic :: View next topic |
Author |
Message |
Solutions Mainframe Beginner
Joined: 11 Oct 2004 Posts: 4 Topics: 2
|
Posted: Mon Oct 11, 2004 2:27 am Post subject: Two Outrecs for Each Inrec Using Sort |
|
|
Hi,
I have the following requirement.
Request to help me If you Can.
Input file has
Code: |
AAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBB
|
OUTPUT FILE SHOULD BE
Code: |
AAAAAAAA11111AAAAAAAA
AA222AAAAAAAAAA333333
BBBBBBBB11111BBBBBBBB
BB222BBBBBBBBBB333333
|
Explanation:
1) For each of the input records 2 records should be written to outputfile.
2)Output file first record has same as input file with one field replacing with constant.
3)Output file Second record same as input file with 2 fields replacing with two different constants.
Can I do this using Sort.
(So that I can avoid writing a new cobol program)
Thank In Advance
Stallin |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Oct 11, 2004 5:22 am Post subject: |
|
|
solutions mainframe,
The following JCL will give you the desired results. I assumed that yout input file is 80 bytes lrecl and is of FB recfm. The parm / on OUTFIL can be used to split the record into 2 records.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBB
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL OUTREC=(1,8, $ FIRST 8 BYTES AS IS
C'11111', $ CONSTANT 11111
9,8, $ COPY 8 BYTES FROM POS 9
80:X,/, $ SPLIT THE RECORD
1,2, $ FIRST 2 BYTES AS IS
C'222', $ CONSTANT 222
3,10, $ COPY 10 BYTES FROM POS 3
C'333333', $ CONSTANT 33333
80:X) $ PAD SPACES TO 80 BYTES
|
Hope this helps...
cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Solutions Mainframe Beginner
Joined: 11 Oct 2004 Posts: 4 Topics: 2
|
Posted: Mon Oct 11, 2004 11:56 am Post subject: |
|
|
kOLUSU,
Thanks for the solution.
It really saved me from writing a cobol program.
Can you please tell is it a preferable approcah in production where data volume is
in Lakhs.
and One more info I need is
if there are 100 such input files with 100 sets of constants(each set for each of the
files)
What is the prefreable approcah
Thanks, |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Oct 11, 2004 12:19 pm Post subject: |
|
|
Solutions Mainframe,
Sort utility is highly tuned, EXCP driven and consumes very less resources. Since you are just copying you don't even need the SORTWORK datasets. I ran a sample job for 5 million and it ran in less than 2 minutes.
Quote: |
if there are 100 such input files with 100 sets of constants(each set for each of the
files) What is the prefreable approcah
|
I would still go with SORT. The pain is to create 100 different sysin parms. How do you correlate the constant with the file? If you can define a relation between the records and the files , then may be we can do using 1 single sysin card.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Solutions Mainframe Beginner
Joined: 11 Oct 2004 Posts: 4 Topics: 2
|
Posted: Tue Oct 12, 2004 2:33 am Post subject: |
|
|
Kolusu,
The constants file I have to create based on the data provided from Client.
The relation is like first record in the sysin is for first input file. second for second record and like..
I am only extarcting the input files from DB table
I Can make all the inputs as GDGs
Thanks, |
|
Back to top |
|
 |
|
|