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
 

 

Convert Decimal to Binary using SORT pgm

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

New User


Joined: 05 Apr 2006
Posts: 14

PostPosted: Mon Jul 03, 2006 1:12 pm    Post subject: Convert Decimal to Binary using SORT pgm
Reply with quote

Hi,

I have an input file of 50 containing.
XXXXXXXXXXYYYYYYYYYY123ZZZZZZZZZZZZZAAAAAAAAAAAAAA

I need to do the following
1) Move the characters/Numeric values before 123 to the output record
2) Convert 123 to COMP format and write it to the output record after 1).
3) And move the values after 123 tilll the end of file to the output record after 1) and 2).

I need to to do it with sort prgm.
Please help me out.

Regards
Sandhya
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Jul 03, 2006 8:03 pm    Post subject:
Reply with quote

The following DFSORT job will do what you asked for. I assumed you wanted a length of 4 for the COMP field, but you can change the LENGTH if appropriate.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/50)
//SORTOUT DD DSN=...  output file (FB/51)
//SYSIN    DD    *
  OPTION COPY
  OUTREC FIELDS=(1,20,
    21,3,ZD,TO=BI,LENGTH=4,
    24,27)
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
sandhyaragav

New User


Joined: 05 Apr 2006
Posts: 14

PostPosted: Tue Jul 04, 2006 9:31 am    Post subject: Re: Convert Decimal to Binary using SORT pgm
Reply with quote

Thank you Frank,

I have tried it out and it worked good.

I had also seen TO=FI
Is this used for converting signed Decimals to COMP?

Sandhya
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Jul 04, 2006 7:56 pm    Post subject:
Reply with quote

BI is unsigned (e.g. X'FFFF' = 65535). FI is signed (e.g. X'FFFF' = -1).

For more details on the various formats supported by DFSORT, and how DFSORT formats relate to COBOL data types, see Appendix C of "z/OS DFSORT Application Programming Guide". You can access it, along with all of the other DFSORT books, from:

http://www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
sandhyaragav

New User


Joined: 05 Apr 2006
Posts: 14

PostPosted: Wed Jul 05, 2006 9:27 am    Post subject: Re: Convert Decimal to Binary using SORT pgm
Reply with quote

Thanks Frank for your quick response and help.
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
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. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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