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
 

 

Reformatting amounts in input file

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

Active User


Joined: 01 Feb 2007
Posts: 113
Location: India

PostPosted: Tue Jun 07, 2011 9:28 am    Post subject: Reformatting amounts in input file
Reply with quote

Hi,
I have uploaded notepad into mainframes which is having account number and 3 amounts. I want to reformat the amounts as shown below.

No specific positions between amounts except the space delimeter.
I want to convert each amount to 15 bytes removing decimal and filling zeroes.

Input File:
Code:

100001 2342.34 1221.30 0
100002 423.25 523.12 9.23
100003 78.48 8.75 1.10


Output File:
Code:

100001 000000000234234 000000000122130 000000000000000
100002 000000000042325 000000000052312 000000000000923
100003 000000000007848 000000000000875 000000000000110


Please let me know how to achive the above output.

Thanks,
Bhaskar
Back to top
View user's profile Send private message

sriram.mukundan

New User


Joined: 20 Nov 2007
Posts: 28
Location: chennai

PostPosted: Tue Jun 07, 2011 11:28 am    Post subject:
Reply with quote

these datas are generally delimited by the tab delimiter and postion may vary from record to record ?
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 113
Location: India

PostPosted: Tue Jun 07, 2011 11:37 am    Post subject: Reformatting amounts in input file
Reply with quote

Hi Sriram,
Yes. What you said is correct. They will be delimited by tab and vary from record to record.

Thanks,
Bhaskar
Back to top
View user's profile Send private message
ajay_diaz
Warnings : 1

New User


Joined: 12 Sep 2005
Posts: 28

PostPosted: Tue Jun 07, 2011 11:50 am    Post subject: Reformatting amounts in input file
Reply with quote

Try this :
Code:

//STEP01 EXEC PGM=SORT
//SORTIN DD *
100001 2342.34 1221.30 0
100002 423.25 523.12 9.23
100003 78.48 8.75 1.10
//SORTOUT DD SYSOUT = *
//SYSIN DD *
   OUTREC PARSE=(%01=(ENDBEFR=C' ',FIXLEN=6),
                 %02=(ENDBEFR=C' ',FIXLEN=15),
                 %03=(ENDBEFR=C' ',FIXLEN=15),
                 %04=(FIXLEN=15)),
   BUILD=(%01,
          08:%02,SFF,EDIT=(TTTTTTTTTTTTTTT),
          24:%03,SFF,EDIT=(TTTTTTTTTTTTTTT),
          40:%04,SFF,EDIT=(TTTTTTTTTTTTTTT))
   SORT FIELDS=(1,6,CH,A)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Tue Jun 07, 2011 12:00 pm    Post subject: Reply to: Reformatting amounts in input file
Reply with quote

Bhaskar,

In your sample data you have a zero which appears as 0 not 0.00. Can you confirm what a whole number (no decimal part) would appear as? So, one, for instance, will it appear as 1 or 1.00? If the former, you can consider rolling with what you have already. If not, then look in forum for quite similar task over last few days.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Jun 07, 2011 12:15 pm    Post subject:
Reply with quote

if there are indeed tabs between fields
(as the TS indicated)
then the following will provide the solution to the TS's requirement:
Code:

OUTREC PARSE=(%01=(ENDBEFR=X'05',FIXLEN=6),
              %02=(ENDBEFR=X'05',FIXLEN=15),
              %03=(ENDBEFR=X'05',FIXLEN=15),
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Jun 08, 2011 12:03 am    Post subject: Reply to: Reformatting amounts in input file
Reply with quote

If you want to pad zeroes for the missing decimals then use the following DFSORT control cards


Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                           
100001 2342.34 1221.30 1                                 
100002 423.25 523.12 9.23                                 
100003 78.48 8.75 1.10                                   
100004 3.43 9.56 2.3                                     
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  INREC PARSE=(%01=(ENDBEFR=C' ',FIXLEN=6),               
               %02=(ENDBEFR=C' ',FIXLEN=15),             
               %03=(ENDBEFR=C' ',FIXLEN=15),             
               %04=(ENDBEFR=C' ',ENDBEFR=C'.',FIXLEN=13),
               %05=(FIXLEN=2)),                           
     BUILD=(%01,X,                                       
            %02,SFF,M11,LENGTH=15,X,                     
            %03,SFF,M11,LENGTH=15,X,                     
            %04,SFF,M11,LENGTH=13,                       
            %05)                                         
                                                         
  OUTREC FINDREP=(STARTPOS=52,INOUT=(C' ',C'0'))         
//*


This will produce

Code:

100001 000000000234234 000000000122130 000000000000100
100002 000000000042325 000000000052312 000000000000923
100003 000000000007848 000000000000875 000000000000110
100004 000000000000343 000000000000956 000000000000230
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 113
Location: India

PostPosted: Wed Jun 08, 2011 12:46 am    Post subject: Reformatting amounts in input file
Reply with quote

Hi All,

Thank you so much.
The job ran fine I got the expected output.

Thanks once again.

- Bhaskar
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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