IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

editting the file by inserting zeros in between


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pramodrsingh

New User


Joined: 20 Dec 2013
Posts: 6
Location: India

PostPosted: Mon Aug 21, 2017 5:58 pm
Reply with quote

Hi friend,

I got a file whose records are like below,

Code:
0000298249_998|2415|1.00|1.11|20170521     
0200416290_001|2415|1.00|0.99|20170521     
0000630382_002|2413|1.00|131.69|20170521 

With the use of DFSORT , I have to edit the file so that records look like

Code:
0000298249_998|002415|01|0001.11|20170521     
0200416290_001|002415|01|0000.99|20170521 
0000630382_002|002413|01|0131.69|20170521


Tried different ways but not helpful. Need your help on this.
Back to top
View user's profile Send private message
prino
Warnings : 1

Senior Member


Joined: 07 Feb 2009
Posts: 1245
Location: Vilnius, Lithuania

PostPosted: Mon Aug 21, 2017 6:36 pm
Reply with quote

pramodrsingh wrote:
Tried different ways but not helpful. Need your help on this.

Maybe when you share the different ways with us? Anyone can say they tried!
Back to top
View user's profile Send private message
pramodrsingh

New User


Joined: 20 Dec 2013
Posts: 6
Location: India

PostPosted: Mon Aug 21, 2017 6:53 pm
Reply with quote

prino wrote:
pramodrsingh wrote:
Tried different ways but not helpful. Need your help on this.

Maybe when you share the different ways with us? Anyone can say they tried!


First,I was able to make them look like as follows, just by simply using some ISPF commands
so they are as follows->

Code:
0000298249_998|002415|01|1.11|20170521 
0200416290_001|002415|01|0.99|20170521 
0000630382_002|002413|01|131.69|20170521


Then I tried to use M11 with uff to insert zeros before "1.11|20170521"

Code:
OPTION COPY                                   
INREC BUILD=(1,25,26,6,UFF,M11,LENGTH=6,32,41)


but output is as follows-

Code:
0000298249_998|002415|01|0011120170521 
0200416290_001|002415|01|0009920170521 
0000630382_002|002413|01|013169|20170521


Can we move 20170521 and insert zeros simultaneously?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Aug 21, 2017 7:05 pm
Reply with quote

Nothing to do with either JCL or VSAM. Moved to DFsort.

After 4 years you should know to use the code tags when posting code and data or anything else that appears on the screen. Coded for you (this time).
Back to top
View user's profile Send private message
pramodrsingh

New User


Joined: 20 Dec 2013
Posts: 6
Location: India

PostPosted: Mon Aug 21, 2017 7:16 pm
Reply with quote

Thanks for correcting Nic. I will take care going onwards..
Back to top
View user's profile Send private message
pramodrsingh

New User


Joined: 20 Dec 2013
Posts: 6
Location: India

PostPosted: Mon Aug 21, 2017 8:26 pm
Reply with quote

pramodrsingh wrote:
prino wrote:
pramodrsingh wrote:
Tried different ways but not helpful. Need your help on this.

Maybe when you share the different ways with us? Anyone can say they tried!


First,I was able to make them look like as follows, just by simply using some ISPF commands
so they are as follows->

Code:
0000298249_998|002415|01|1.11|20170521 
0200416290_001|002415|01|0.99|20170521 
0000630382_002|002413|01|131.69|20170521


Then I tried to use M11 with uff to insert zeros before "1.11|20170521"

Code:
OPTION COPY                                   
INREC BUILD=(1,25,26,6,UFF,M11,LENGTH=6,32,41)


but output is as follows-

Code:
0000298249_998|002415|01|0011120170521 
0200416290_001|002415|01|0009920170521 
0000630382_002|002413|01|013169|20170521


Can we move 20170521 and insert zeros simultaneously?


Hi Prino,

Can you please help me here?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Aug 21, 2017 8:43 pm
Reply with quote

I would suggest PARSEing the fields into separate variables and then when you rebuild them apply the formatting as required.

There may be better ways.
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Mon Aug 21, 2017 8:45 pm
Reply with quote

Here is the snippest code..

Code:

OPTION COPY                                   
INREC PARSE=(%00=(ENDBEFR=C'|',FIXLEN=14),     
             %01=(ENDBEFR=C'|',FIXLEN=06),     
             %02=(ENDBEFR=C'|',FIXLEN=02),     
             %03=(ENDBEFR=C'|',FIXLEN=07),     
             %04=(FIXLEN=8)),                 
      BUILD=(%00,C'|',                         
             %01,UFF,ZD,LENGTH=6,C'|',         
             %02,UFF,EDIT=(TT),C'|',           
             %03,UFF,EDIT=(TTTT.TT),C'|',     
             %04)                             


I am truncating two bytes here, assuming that position always has 1.00.

Code:

%02=(ENDBEFR=C'|',FIXLEN=02),


You may need need to change this according to your requirement and adjust following code accordingly.

Code:

%02,UFF,EDIT=(TT),C'|',
Back to top
View user's profile Send private message
pramodrsingh

New User


Joined: 20 Dec 2013
Posts: 6
Location: India

PostPosted: Mon Aug 21, 2017 9:26 pm
Reply with quote

magesh23586 wrote:
Here is the snippest code..

Code:

OPTION COPY                                   
INREC PARSE=(%00=(ENDBEFR=C'|',FIXLEN=14),     
             %01=(ENDBEFR=C'|',FIXLEN=06),     
             %02=(ENDBEFR=C'|',FIXLEN=02),     
             %03=(ENDBEFR=C'|',FIXLEN=07),     
             %04=(FIXLEN=8)),                 
      BUILD=(%00,C'|',                         
             %01,UFF,ZD,LENGTH=6,C'|',         
             %02,UFF,EDIT=(TT),C'|',           
             %03,UFF,EDIT=(TTTT.TT),C'|',     
             %04)                             


I am truncating two bytes here, assuming that position always has 1.00.

Code:

%02=(ENDBEFR=C'|',FIXLEN=02),


You may need need to change this according to your requirement and adjust following code accordingly.

Code:

%02,UFF,EDIT=(TT),C'|',


Hi Magesh,

That works well for me and serve the purpose. Really Thankful to you, provided great help in short span of time.
Back to top
View user's profile Send private message
pramodrsingh

New User


Joined: 20 Dec 2013
Posts: 6
Location: India

PostPosted: Mon Aug 21, 2017 9:28 pm
Reply with quote

Nic Clouston wrote:
I would suggest PARSEing the fields into separate variables and then when you rebuild them apply the formatting as required.

There may be better ways.


Thanks Nic,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Remove commas from specific positions... DFSORT/ICETOOL 10
No new posts Uploading from desktop, a CSV file, s... DB2 2
No new posts Get two files from one file with diff... DFSORT/ICETOOL 10
No new posts View GDG data which is copied from a ... JCL & VSAM 2
No new posts How to read unpacked field created in... DFSORT/ICETOOL 12
Search our Forums:

Back to Top