As per my requrement i need to format the below file, please let me know how this can be done via sort.
Input :--
Code:
Ref no. Details Ind
123456 This data relates to N
Account 912839012830 which is of high risk
and can cause issues.
781010 Any information for Y
this account 182390203 can be of issues.
973919 For this we need to Y
raise this issue to manager
Output :---
Code:
123456 This data relates to Account 912839012830 which is of high risk and can cause issues. N
781010 Any information for this account 182390203 can be of issues. Y
973919 For this we need to raise this issue to manager Y
Rules:-
The Max record length of Details is 60 bytes and MIN is 25 bytes (first rec.). There can
be the MAX 10 detail records for a ref no.
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
Suppose there is one more record in input which is quite longer,
Will this type of output acceptable?
Code:
123456 This data relates to Account 912839012830 which is of high risk and can cause issues. N
781010 Any information for this account 182390203 can be of issues. Y
973919 For this we need to raise this issue to manager Y
123423345 I am unable to imagine any text that can be written here, so lets fill up the space with something Y
or you want the output to be like this,
Code:
123456 This data relates to Account 912839012830 which is of high risk and can cause issues. N
781010 Any information for this account 182390203 can be of issues. Y
973919 For this we need to raise this issue to manager Y
123423345 I am unable to imagine any text that can be written here, so lets fill up the space with something Y
123456 This data relates to Account 912839012830 which is of high risk and can cause issues. N
781010 Any information for this account 182390203 can be of issues. Y
973919 For this we need to raise this issue to manager Y
123423345 I am unable to imagine any text that can be written here, so lets fill up the space with something Y
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
enrico,
You don't need 2 passes( a copy and splice sort) of data . It can be done with just a single pass (Splice Copy) as the data is being merged.
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYMNAMES DD *
REFN,01,06,CH
DET1,10,25,CH
DETL,10,60,CH
FLAG,38,01,CH
//INP DD *
123456 THIS DATA RELATES TO N
ACCOUNT 912839012830 WHICH IS OF HIGH RISK
AND CAN CAUSE ISSUES.
781010 ANY INFORMATION FOR Y
THIS ACCOUNT 182390203 CAN BE OF ISSUES.
973919 FOR THIS WE NEED TO Y
RAISE THIS ISSUE TO MANAGER
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(INP) TO(OUT) ON(REFN) WITHANY USING(CTL1) -
WITH(010,25) WITH(035,60) -
WITH(095,60) WITH(155,60) -
WITH(215,60) WITH(275,60) -
WITH(335,60) WITH(395,60) -
WITH(455,60) WITH(515,60)
//*
//CTL1CNTL DD *
OPTION COPY
INREC IFOUTLEN=575,
IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,NE,C' '),PUSH=(81:REFN,87:FLAG)),
IFTHEN=(WHEN=INIT,OVERLAY=(88:SEQNUM,2,ZD,RESTART=(81,6))),
IFTHEN=(WHEN=(88,2,ZD,EQ,01),BUILD=(81,6,010:DET1,575:87,1)),
IFTHEN=(WHEN=(88,2,ZD,EQ,02),BUILD=(81,6,035:DETL)),
IFTHEN=(WHEN=(88,2,ZD,EQ,03),BUILD=(81,6,095:DETL)),
IFTHEN=(WHEN=(88,2,ZD,EQ,04),BUILD=(81,6,155:DETL)),
IFTHEN=(WHEN=(88,2,ZD,EQ,05),BUILD=(81,6,215:DETL)),
IFTHEN=(WHEN=(88,2,ZD,EQ,06),BUILD=(81,6,275:DETL)),
IFTHEN=(WHEN=(88,2,ZD,EQ,07),BUILD=(81,6,335:DETL)),
IFTHEN=(WHEN=(88,2,ZD,EQ,08),BUILD=(81,6,395:DETL)),
IFTHEN=(WHEN=(88,2,ZD,EQ,09),BUILD=(81,6,455:DETL)),
IFTHEN=(WHEN=(88,2,ZD,EQ,10),BUILD=(81,6,515:DETL))