SYNCSORT -appending data from 2 files
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Utilities

#1: SYNCSORT -appending data from 2 files Author: rasprasadsLocation: Chennai PostPosted: Wed Dec 11, 2002 9:52 am
    —
I have 2 input files with following descriptions:

1.First file
LRECL=300
No of records=5000(may vary for each run)

2.Second file
LRECL=5(Packed decimal)
No of record=1(The content may vary for each run)

I need to get an output file with LRECL=305 with the data in second file being appended at the end to all the records in the first file.(So it would have 5000 records)

I do not want to use COBOL program.
I want to do it through JCL SYNCSORT.
How can this output be produced with SYNCSORT(i do not have DFSORT)...


Thanks
Rasprasad S

#2:  Author: kolusuLocation: San Jose PostPosted: Wed Dec 11, 2002 11:08 am
    —
Rasprasad,

The following JCl will give you the desired results.

Code:

//STEP0100 EXEC PGM=SYNCTOOL
//*
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN1      DD DSN=YOUR 300 LRECL FILE,
//            DISP=SHR
//IN2      DD DSN=YOUR 5 LRECL FILE,
//            DISP=SHR
//OUT      DD DSN=OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//TOOLIN   DD *
  COPY   FROM(IN2) TO(CTL2CNTL) USING(CTL1)
  COPY   FROM(IN1) TO(OUT)      USING(CTL2)
//CTL1CNTL DD *
  OUTREC FIELDS=(C' OUTREC FIELDS=(1,300,C''',1,5,C''')',80:X) 
//CTL2CNTL DD DSN=&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(1,1),RLSE)
/*


Hope this helps...

cheers

kolusu

#3:  Author: CaptBillLocation: Pasadena, California, USA PostPosted: Wed Dec 11, 2002 12:46 pm
    —
Rasprasad,

I believe you asked this in old help board too. Rolling Eyes

#4:  Author: rajvasan PostPosted: Wed Dec 18, 2002 3:06 am
    —
Kolusu,
I have a doubt. When the first Copy statement is encountered, the temporary dataset T1 is created and contains the dynamic control card. When the subsequent Copy statement is encountered, it refers to CTL2
(which is CTL2CNTL), would it not try to create a dataset that has already been created during the first COPY statement, and hence throw a JCL error. Can you please explain this...

#5:  Author: kolusuLocation: San Jose PostPosted: Wed Dec 18, 2002 4:12 am
    —
Rajvasan,

Take a close look at the control statements

Code:

  COPY   FROM(IN2) TO(CTL2CNTL) USING(CTL1)
  COPY   FROM(IN1) TO(OUT)      USING(CTL2)


The first copy statement is creating the CTL2CNTL dataset ( as you can see from the clause TO)

The second copy statement is USING the CTL2 control card created in the first copy statement and creating OUT dataset( as you can see from the clause TO)

Basically the second copy statement is USING the control card created , so there is no question of creating the CTL2 dataset again in the second copy step.

Hope this helps....

cheers

kolusu



MVSFORUMS.com -> Utilities


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group