Niki
Active User
Joined: 20 Sep 2008 Posts: 106 Location: Bangalore
|
|
|
|
Hii all,
I am having an input file of LRECL = 80, FB. Please find a sample file below,
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
21524*#limited comp *#1111*#abc comp ltd *#O *#6012
05555*# *# *#New York *# *#
|
I need the output like below,
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
21524*#limited comp*#1111*#abc comp ltd*#O*#6012
05555*#*#*#New York*#
|
I used the sort
OPTION COPY
INREC BUILD=(1,80,SQZ=(SHIFT=LEFT)) and it is squeezing all the spaces.
But i need space between words like "abc comp ltd".
The logic i suppose is Omitting out the spaces present befor the symbol/delimiter "*#" in each field.
Please help me out if someone has sample code to accomplish this.
Note :- Dont know how may fields ll be there and the length of the fields might differ. |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Niki,
I believe a DFSORT job like the following will do what you asked for:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
21524*#limited comp *#1111*#abc comp ltd *#O *#6012
05555*# *# *#New York *# *#
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
BUILD=(1,5,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=7),X,
7,18,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=20),X,
26,5,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=7),X,
32,17,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=19),X,
50,5,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=7),X,
56,10,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=12),
80:X)),
IFTHEN=(WHEN=INIT,
BUILD=(1,80,SQZ=(SHIFT=LEFT,MID=C'*',PAIR=QUOTE))),
IFTHEN=(WHEN=INIT,
FINDREP=(IN=C'"',OUT=C''))
/*
|
|
|