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 

Two Outrecs for Each Inrec Using Sort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Solutions Mainframe
Beginner


Joined: 11 Oct 2004
Posts: 4
Topics: 2

PostPosted: Mon Oct 11, 2004 2:27 am    Post subject: Two Outrecs for Each Inrec Using Sort Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Oct 11, 2004 5:22 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Solutions Mainframe
Beginner


Joined: 11 Oct 2004
Posts: 4
Topics: 2

PostPosted: Mon Oct 11, 2004 11:56 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Oct 11, 2004 12:19 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Solutions Mainframe
Beginner


Joined: 11 Oct 2004
Posts: 4
Topics: 2

PostPosted: Tue Oct 12, 2004 2:33 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities 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