View previous topic :: View next topic
Author
Message
Niki Active User Joined: 20 Sep 2008Posts: 106 Location: Bangalore
Hi All,
Could anyone please help me in the below required sort:
I/P File : -
VB, Lrecl = 1000
Condition :
1) Need to pick the values from position 10, length = 10. This is the key field for each and every record present in the input file.
2) For a record, search for the character "$", if found then pick the next 6 characters from the record and write it in the o/p. One record can contain more than one "$" values.
Each output record should append with the key value and the corresponding $ values. for e.g :-
Key $val1 $val2 $val3 then the o/p ll be ,
Key $val1
Key $val2
Key $val3
3) If the $ value is not present in the record then skip the record.
The input file looks like below.
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
ASDHJHHHC1234567890ASSD20219B$958746ASD99052565$852741887599999999
ASFFASFES98765432107834678 9999990525650010130000199999999
999999999852741963009SD20213NHJSF$65478900000650010130000199999999
999999999159753852913SD20$851239DBA ASND$95147801013000019$999999
999999999391478562018SD20219DFASDVAHVAVDHASCD650010130000199999999
And the output should look like below,
The format and LRECL of o/p file should be of input file.
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
1234567890 $958746
1234567890 $852741
8527419630 $654789
1597538529 $851239
1597538529 $951478
1597538529 $999999
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Quote:
One record can contain more than one "$" values.
What is the maximum number of "$" values one record can contain?
Back to top
Niki Active User Joined: 20 Sep 2008Posts: 106 Location: Bangalore
Hi Frank,
Thanks for your reply.
In the above query , the maximum no of $ values on each record can be 99.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
You could use a DFSORT/ICETOOL job like the following to do what you want (although I'm not sure you'll want to):
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (VB/1000)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD LRECL=1000,DSN=... output file (VB/1000)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,VLTRIM=C' ',
PARSE=(%01=(ABSPOS=24,STARTAT=C'$',FIXLEN=7),
%02=(STARTAT=C'$',FIXLEN=7),
... fill in the rest
%98=(STARTAT=C'$',FIXLEN=7),
%99=(STARTAT=C'$',FIXLEN=7)),
BUILD=(1,4,14,10,X,%01,/,
1,4,14,10,X,%02,/,
... fill in the rest
1,4,14,10,X,%98,/,
1,4,14,10,X,%99)
/*
//CTL2CNTL DD *
OMIT COND=(1,2,BI,LT,16)
/*
Back to top
Niki Active User Joined: 20 Sep 2008Posts: 106 Location: Bangalore
Hi Frank,
Thanks a lot for your help.
I made the change as per my requirement by keeping this as a base and it is working fine.
Back to top
Please enable JavaScript!