|
|
| Author |
Message |
smita V
New User
Joined: 05 Nov 2007 Posts: 4 Location: hyderabad
|
|
|
|
Hi!
Using Syncsort, from a flat file I hav to do modification on some selected records and has to write all the records(modified as well as untouched records) into output file.
Is it possible in a single step and how? |
|
| Back to top |
|
 |
References
|
|
 |
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 156 Location: PUNE(INDIA)
|
|
|
|
Hi Smita V,
| Quote: |
Using Syncsort, from a flat file I hav to do modification on some selected records and has to write all the records(modified as well as untouched records) into output file.
Is it possible in a single step and how?
|
Yes, it is possible. Please give sample input file and sample output along with other info like LRECL and RECFM of file.
--Parag |
|
| Back to top |
|
 |
smita V
New User
Joined: 05 Nov 2007 Posts: 4 Location: hyderabad
|
|
|
|
Hi Parag!
Input File:
1234abcdef
1235avbtef
1236
1237ujyrtbv
1238
Output file should be ==>
1234abcdef
1235avbtef
1236*****
1237ujyrtb
1238*****
I have to select records from input file which has spaces from 5th byte onwards and have to populate system date value on it.
I tried IFTHEN option but it is not working for me.
Note: We use version 1.2 not 1.3, is that a problem for IFTHEN not to work.
I want to get this done in single step that's why not spliting the file and then merging it. |
|
| Back to top |
|
 |
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 156 Location: PUNE(INDIA)
|
|
|
|
Hi Smita V,
| Quote: |
I tried IFTHEN option but it is not working for me.
Note: We use version 1.2 not 1.3, is that a problem for IFTHEN not to work.
|
Hmmm..... I too have no idea about this.
Probably some senior members or syncsort experts will be able to throw some light on this.
Anyway, here is a synctool job that works on my platform and does what you asked for.
| Code: |
//S1 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
1234ABCDEF
1235AVBTEF
1236
1237UJYRTBV
1238
/*
//OUT1 DD DSN=OUTPUT-FILE-NAME,
// DSORG=PS,RECFM=FB,SPACE=(CYL,(10,10),RLSE),
// DISP=(NEW,CATLG,DELETE)
//TOOLIN DD *
COPY FROM(IN1) TO(OUT1) USING(SRT1)
/*
//SRT1CNTL DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(5,8,CH,EQ,C' '),
BUILD=(1,4,DATE1,13,68)),
IFTHEN=(WHEN=NONE,
BUILD=(1,80))
/*
|
Output :
| Code: |
1234ABCDEF
1235AVBTEF
123620080325
1237UJYRTBV
123820080325
|
--Parag |
|
| Back to top |
|
 |
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 162 Location: hyderabad
|
|
|
|
Hi,
Please see the other solution without the IFTHEN.
| Code: |
//PS020 EXEC PGM=SYNCTOOL
//SYSOUT DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
1234ABCDEF
1235AVBTEF
1236
1237UJYRTBV
1238
//T1 DD DSN=&&T1,UNIT=SCRPK,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SCRPK,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT2 DD SYSOUT=*
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=SHR
// DD DSN=*.T2,VOL=REF=*.T2,DISP=SHR
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SORT FROM(CON) TO(OUT2) USING(CTL2)
//CTL1CNTL DD *
INREC FIELDS=(1,12,15:SEQNUM,8,ZD,80:X)
OUTFIL FNAMES=T1,
INCLUDE=(5,1,CH,EQ,C' '),
OUTREC=(1,4,DATE1,2X,15,8)
OUTFIL FNAMES=T2,
INCLUDE=(5,1,CH,NE,C' '),
OUTREC=(1,12,2X,15,8)
//CTL2CNTL DD *
SORT FIELDS=(15,8,CH,A)
OUTREC FIELDS=(1,14,80:X)
|
| Code: |
output (OUT2 ):
1234ABCDEF
1235AVBTEF
123620080325
1237UJYRTBV
123820080325
|
Thanks
Krishy |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 252 Location: USA
|
|
|
|
| smita V wrote: |
I tried IFTHEN option but it is not working for me.
|
How is it "not working"? Are you getting a syntax error?
Support for IFTHEN was included in SyncSort for z/OS 1.2.1 and later.
If you are running SyncSort for z/OS 1.2.0, then this can still be accomplished in a single pass of the data without using IFTHEN. You can code an INREC statement to add a field at the end of the record which contains the current system date, and then use that field as the replacement value in OUTREC CHANGE. |
|
| Back to top |
|
 |
smita V
New User
Joined: 05 Nov 2007 Posts: 4 Location: hyderabad
|
|
|
|
Hi Krishy,
Thanks, your logic worked perfectly for me......
Hi Alissa,
Our syncsort version is 1.2.0, thats why I was getting Syntax error with IFTHEN..........
Thanks,
Smita |
|
| Back to top |
|
 |
|
|
|