Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to reformat a field in a delimited file with VB recs ?

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

New User


Joined: 01 Jul 2012
Posts: 1
Location: USA

PostPosted: Sat Jul 14, 2012 8:20 am    Post subject: How to reformat a field in a delimited file with VB recs ?
Reply with quote

There is a file where (see attachment) a field in all records needs to have leading zeros suppressed, for example:

004102109 needs to be 4102109. I am able to make this work as long as the fields are located in the same position. Unfortunately in my file the data is delimited and not always in the same location, although it is always right after the 6th delimiter (|~|). Do you know how to position the sort to the location based on the number of delimiters and then do the suppression?

Code below will work if the exact position is known for a particular record (see attachment for record details):

Code:
SORT FIELDS=COPY                                       
 SUM FIELDS=(64,09,ZD)                                 
 OUTFIL IFTHEN=(WHEN=(53,5,CH,EQ,C'CHBRX'),             
  OVERLAY=(64:64,9,ZD,M10,LENGTH=9,64:64,9,             
     SQZ=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"')),HIT=NEXT), 
       IFTHEN=(WHEN=(53,5,CH,EQ,C'CHBRX'),             
         OVERLAY=(64:64,9,                             
           SQZ=(SHIFT=LEFT,PAIR=QUOTE)),HIT=NEXT),     
         IFTHEN=(WHEN=(53,5,CH,EQ,C'CHBRX'),           
            FINDREP=(IN=C'"',OUT=C''))


Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8                                       1       2                 3                               
2930078510~00001|~|R|~|00001|~|20111127010101|~|CHBRX|~||~|3192431|~|CHBRX~02220 <<<<<<< I was able to suppress the zeros because I new the exact column for this record
2930078510~00001|~|R|~|00002|~|20111127010101|~|CHBRX|~||~|3192431|~|CHBRX~02220
2844321610~00001|~|P|~|00001|~|20111127010101|~|HANRX|~|66638|~|004158481|~|HANR <<<<<< this needs to be suppressed as well but it begins in another column
2844321610~00001|~|P|~|00002|~|20111127010101|~|HANRX|~|66638|~|004158481|~|HANR
2157690610~00001|~|R|~|00001|~|20111127010101|~|NALC|~|GROUP|~|000294922|~|NALC~
2157690610~00001|~|R|~|00002|~|20111127010101|~|NALC|~|GROUP|~|000294922|~|NALC~
2324411610~00001|~|R|~|00001|~|20111127010101|~|NALC|~|GROUP|~|000294922|~|NALC~


Code that works based on looking at a fixed column is below. Note that the variable length of the record was taken into account by adding 4 bytes to the position. 'CHBRX' starts in column 49 on the layout but 4 was addded to make the location 53 as used in the code:

Your post has been Code'd and the attachment inlined.

Please use the Code tags to preserve spacing where necessary and post file examples in the Code tags, not as attachments.
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1542
Location: Andromeda Galaxy

PostPosted: Sat Jul 14, 2012 11:20 am    Post subject:
Reply with quote

Hi,

I not able to view the attachment from mobile

But looking at your sort card I would suggest you to make use of PARSE

Read the manuals and search forum for samples on PARSE

After parsing you should be able to reformat

Also is that you wanted to remove leading Zeroes or first two bytes?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sat Jul 14, 2012 2:07 pm    Post subject: Reply to: How to reformat a field in a delimited file with V
Reply with quote

Why do you have SUM with a COPY operation?

Presumably the extra four bytes are because you have a variable-length record?

There are many PARSE examples in the forum.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Sat Jul 14, 2012 2:39 pm    Post subject:
Reply with quote

in case you don't understand Bill's comment about SUM with a COPY operation,
you are invited to read the manual concerning the SUM Control Statement
which you have obviously overlooked.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sun Jul 15, 2012 1:53 pm    Post subject: Reply to: How to reformat a field in a delimited file with V
Reply with quote

Just wondering now why you want to replace the leading zeros. Wherever the file is going they will still be treated as zero, therefore numerically equivalent to the zero-suppressed value...
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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us