View previous topic :: View next topic
Author
Message
Hemamalini Vasudevan New User Joined: 21 Sep 2006Posts: 5
The input file is
01UPC|BRAND|ITEM|U_SIZE|UNIT_OF_MEASURE|GROUP|
02UPC|HEALTH_CONDITION
03UPC|SUBSEGMENT
U|01|000004201943|GEROLSTEINER|Gerolsteiner Sp
U|03|000004201943|OGNONE
U|01|000004207705|DR HAUSCHKA|Dr Hauschka Lip
U|03|000004207705|OGCTBC
I was just loooking for a way to add a pipe symbol to the first 3 records alone.
where the output should be
|01UPC|BRAND|ITEM|U_SIZE|UNIT_OF_MEASURE|GROUP|
|02UPC|HEALTH_CONDITION
|03UPC|SUBSEGMENT
U|01|000004201943|GEROLSTEINER|Gerolsteiner Sp
U|03|000004201943|OGNONE
U|01|000004207705|DR HAUSCHKA|Dr Hauschka Lip
U|03|000004207705|OGCTBC
Can you please guide me on this.
Thanks,
Hema
Back to top
Ganesh.Deokar New User Joined: 30 Sep 2005Posts: 26 Location: Buffalo,NY
What is the input record length? what should be the output record length.
I tried this one with input lrecl as 80.
Code:
//SRT80301 EXEC PGM=SORT
//*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//*
//SORTIN DD DSN=YOUR.SORTIN.FILE,DISP=SHR
//SORTOUT DD DSN=YOUR.SORTOUT.FILE,DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(1,1)),DCB=*.SORTIN
//SYSIN DD *
SORT FIELDS=COPY
INREC BUILD=(1,80,81:SEQNUM,8,ZD)
OUTREC IFTHEN=(WHEN=(81,8,ZD,LE,3),
BUILD=(1:C'|',2:1,80)),
IFTHEN=(WHEN=(81,8,ZD,GT,3),
BUILD=(1:1,80))
/*
//
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Hema,
I assumed your input file has RECFM=FB and LRECL=80 and you want that for the output too, but the jobs can be changed for other attributes.
If the first three records can be identified by not having 'U' in position 1, then you can use a DFSORT job like this:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
01UPC|BRAND|ITEM|U_SIZE|UNIT_OF_MEASURE|GROUP|
02UPC|HEALTH_CONDITION
03UPC|SUBSEGMENT
U|01|000004201943|GEROLSTEINER|Gerolsteiner Sp
U|03|000004201943|OGNONE
U|01|000004207705|DR HAUSCHKA|Dr Hauschka Lip
U|03|000004207705|OGCTBC
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(1,1,CH,NE,C'U'),
BUILD=(C'|',1,79))
/*
If the first three records can only be identified as the first three records, then you can use a DFSORT job like this:
Code:
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
01UPC|BRAND|ITEM|U_SIZE|UNIT_OF_MEASURE|GROUP|
02UPC|HEALTH_CONDITION
03UPC|SUBSEGMENT
U|01|000004201943|GEROLSTEINER|Gerolsteiner Sp
U|03|000004201943|OGNONE
U|01|000004207705|DR HAUSCHKA|Dr Hauschka Lip
U|03|000004207705|OGCTBC
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(81,8,ZD,LE,+3),BUILD=(C'|',1,79))
/*
Back to top
krisprems Active Member Joined: 27 Nov 2006Posts: 649 Location: India
Hemamalini Vasudevan
As per your sample i/p records i observerd that there is a PIPE(|) in 2nd position of every record other than the first 3 records....If that is the case u can use the below untested SORT card.
Code:
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
01UPC|BRAND|ITEM|U_SIZE|UNIT_OF_MEASURE|GROUP|
02UPC|HEALTH_CONDITION
03UPC|SUBSEGMENT
U|01|000004201943|GEROLSTEINER|Gerolsteiner Sp
U|03|000004201943|OGNONE
U|01|000004207705|DR HAUSCHKA|Dr Hauschka Lip
U|03|000004207705|OGCTBC
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=(2,1,CH,NE,C'|'),BUILD=(C'|',1,79))
/*
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Krisprems,
Your job is similar to my first job -it just checks a different value. This technique can be used for any value that will identify one set of records vs the other set of records.
Note that you don't need IFOUTLEN=80 since the input records are 80 bytes and the record you're building is 80 bytes.
Back to top
Hemamalini Vasudevan New User Joined: 21 Sep 2006Posts: 5
Thanks a lot. Yes with INREC IFTHEN BUILD i was able to add PIPE to the first 3 records.
I tried all the options and it worked. Thanks a lot, i learned new syntax in sort.
Back to top
krisprems Active Member Joined: 27 Nov 2006Posts: 649 Location: India
Frank Yaeger wrote:
Krisprems,
Your job is similar to my first job
Infact i copy pasted your JOB and made the modifications
-it just checks a different value. This technique can be used for any value that will identify one set of records vs the other set of records.
I do agree, but i just thought that since we know how the records are in the sample i/p, we could avoid the sequence numbering.
Note that you don't need IFOUTLEN=80 since the input records are 80 bytes and the record you're building is 80 bytes.
Yes, i realised it ...(i didnt get a chance to test it....so..)
Back to top
Please enable JavaScript!