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
 

 

Inserting values at more than 1 place in a record

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

New User


Joined: 11 Sep 2007
Posts: 65
Location: Gurgaon

PostPosted: Sat Nov 16, 2013 10:59 am    Post subject: Inserting values at more than 1 place in a record
Reply with quote

Following is Input record

Code:
AA0BBZCC0DD


Requirement:
If the 3rd position is Zero, insert 2 zeroes more at 4 and 5th position
If the 3rd position is not Zero, insert 2 spaces at 4 and 5th position
If the 6th position is Zero, insert 2 zeroes more at 7 and 8th position
If the 6th position is not Zero, insert 2 spaces at 7 and 8th position

Thus the above record value in output should be
Code:
AA000BBZ  CC0DD


I have written the following to test, but its not working. I am getting following output

Code:
AA000BBZCC0DD


Code i have written
Code:

SORT FIELDS=COPY                                         
  OUTREC IFTHEN=(WHEN=(3,1,CH,EQ,C'0'),                 
                 BUILD=(1:1,3,4:C'00',6:4,15)),         
         IFTHEN=(WHEN=(3,1,CH,NE,C'0'),                 
                 BUILD=(1:1,3,4:C'  ',6:4,15)),         
         IFTHEN=(WHEN=(6,1,CH,NE,C'0'),                 
                 BUILD=(1:1,6,7:C'  ',10:7,11))         



I beleive after first IFTHEN, the code came out. Please let me know how can i give these conditions
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sat Nov 16, 2013 12:57 pm    Post subject: Reply to: Inserting values at more than 1 place in a record
Reply with quote

You need to consult the manual.

There you will discover that once one IFTHEN=(WHEN=(logical-expression is satisfied, no more more are tested for that record. You will also discover there is a way to modify this behaviour, HIT=NEXT.

Code:
SORT FIELDS=COPY                                         
  OUTREC IFTHEN=(WHEN=INIT,                 
                 BUILD=(1,3,C'  ':4,15)),         
         IFTHEN=(WHEN=(3,1,CH,EQ,C'0'),                 
                 OVERLAY=(4:C'00'),HIT=NEXT),         
         IFTHEN=(WHEN=(6,1,CH,NE,C'0'),                 
                 BUILD=(1,6,C'  ',7,11))     


I've simplified your code slightly. This should work. Understand why before using it for real.
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 Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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