Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reformating records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 188
Location: india

PostPosted: Wed Feb 08, 2012 11:02 am    Post subject: Reformating records
Reply with quote

Hello People,

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.

Thank You,
Rajat
Back to top
View user's profile Send private message

vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1475
Location: Chennai

PostPosted: Wed Feb 08, 2012 11:48 am    Post subject:
Reply with quote

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
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 188
Location: india

PostPosted: Wed Feb 08, 2012 3:44 pm    Post subject:
Reply with quote

Hello,

Yes, I want the output 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
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Wed Feb 08, 2012 4:42 pm    Post subject: Reply to: Reformating records
Reply with quote

the real question, that You do not seem to understand, is where do You want the indicator flag


Code:
field       start   length

ref. no     1       6     
details     10      625/565
flag        625/575 1       


adjust the start position according to the lengths
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Thu Feb 09, 2012 12:10 am    Post subject: Reply to: Reformating records
Reply with quote

here is a snippet that might be useful ( TESTED AND WORKING )
Code:


 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,                                         
 000002 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X                       
 000003 //*                                                                     
 000004 //ICE     EXEC PGM=ICETOOL                                             
 000005 //TOOLMSG   DD SYSOUT=*                                                 
 000006 //DFSMSG    DD SYSOUT=*                                                 
 000007 //TMP       DD DISP=(MOD,PASS),                                         
 000008 //             UNIT=SYSDA,SPACE=(CYL,(8,8))                             
 000009 //SYMNAMES  DD *                                                       
 000010 REFN,01,06,CH                                                           
 000011 DET1,10,25,CH                                                           
 000012 DETL,10,60,CH                                                           
 000013 FLAG,38,01,CH                                                           
 000014 //IN1       DD *                                                       
 000015 123456   THIS DATA RELATES TO        N                                 
 000016          ACCOUNT 912839012830 WHICH IS OF HIGH RISK                     
 000017          AND CAN CAUSE ISSUES.                                         
 000018 781010   ANY INFORMATION FOR         Y                                 
 000019          THIS ACCOUNT 182390203 CAN BE OF ISSUES.                       
 000020 973919   FOR THIS WE NEED TO         Y                                 
 000021          RAISE THIS ISSUE TO MANAGER                                   
 000022 //OUT       DD DISP=(NEW,CATLG),                                       
 000023 //             DSN=ENRICO.SORT.OUT,                                     
 000024 //             DCB=(RECFM=FB,LRECL=575),                               
 000025 //             UNIT=SYSDA,SPACE=(CYL,(8,8))                             
 000026 //TOOLIN    DD *                                                       
 000027   COPY   FROM(IN1) TO(TMP) USING(CTL1)                                 
 000028   SPLICE FROM(TMP) TO(OUT) ON(REFN) WITHANY  USING(CTL2) -             
 000029          WITH(010,25) WITH(035,60) -                                   
 000030          WITH(095,60) WITH(155,60) -                                   
 000031          WITH(215,60) WITH(275,60) -                                   
 000032          WITH(335,60) WITH(395,60) -                                   
 000033          WITH(455,60) WITH(515,60)                                     
 000034 //CTL1CNTL DD *                                                         
 000035   OPTION COPY                                                           
 000036   INREC  IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,NE,C' '),                     
 000037                  PUSH=(81:REFN,87:FLAG))                               
 000038   OUTREC IFOUTLEN=575,                                                 
 000039          IFTHEN=(WHEN=INIT,OVERLAY=(88:SEQNUM,2,ZD,RESTART=(81,6))),   
 000040          IFTHEN=(WHEN=(88,2,ZD,EQ,01),BUILD=(81,6,010:DET1,575:87,1)), 
 000041          IFTHEN=(WHEN=(88,2,ZD,EQ,02),BUILD=(81,6,035:DETL)),           
 000042          IFTHEN=(WHEN=(88,2,ZD,EQ,03),BUILD=(81,6,095:DETL)),           
 000043          IFTHEN=(WHEN=(88,2,ZD,EQ,04),BUILD=(81,6,155:DETL)),           
 000044          IFTHEN=(WHEN=(88,2,ZD,EQ,05),BUILD=(81,6,215:DETL)),           
 000045          IFTHEN=(WHEN=(88,2,ZD,EQ,06),BUILD=(81,6,275:DETL)),           
 000046          IFTHEN=(WHEN=(88,2,ZD,EQ,07),BUILD=(81,6,335:DETL)),           
 000047          IFTHEN=(WHEN=(88,2,ZD,EQ,08),BUILD=(81,6,395:DETL)),           
 000048          IFTHEN=(WHEN=(88,2,ZD,EQ,09),BUILD=(81,6,455:DETL)),           
 000049          IFTHEN=(WHEN=(88,2,ZD,EQ,10),BUILD=(81,6,515:DETL))           
 000050 //CTL2CNTL DD *                                                         
 000051   OUTFIL FNAMES=OUT,                                                   
 000052          OVERLAY=(10:10,565,SQZ=(SHIFT=LEFT,MID=C' ',LENGTH=565))       
 000053 //*                                                                     
 ****** **************************** Bottom of Data ****************************


but Frank or Kolusu might certainly come up with a better solution
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Feb 09, 2012 12:53 am    Post subject: Reply to: Reformating records
Reply with quote

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))               
                                                                   
  OUTFIL OVERLAY=(10:10,565,SQZ=(SHIFT=LEFT,MID=C' ',LENGTH=565))   
//*
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 188
Location: india

PostPosted: Thu Feb 09, 2012 8:34 am    Post subject:
Reply with quote

Thanks a lot... its perfect
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us