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 from binary to character using dfsort

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

New User


Joined: 25 Nov 2008
Posts: 9
Location: providence, ri

PostPosted: Mon Jun 22, 2009 10:37 pm    Post subject: Convert from binary to character using dfsort
Reply with quote

Hi.. I tried digging into this one but could not find a way to do it.

I have a s9(8) comp field that needs to be converted to an x(16) field. I tried using the length function, but that ended up right justifying the values in the field. I want it to be left justified. Is this possible?

Thanks in advance
n
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Mon Jun 22, 2009 11:07 pm    Post subject:
Reply with quote

knarayan,

The following control cards will give you the desired results.

Assumptions:

1. Your input is FB recfm and 80 bytes in length
2. Your integer s9(8) comp field starts in position 1 and has only positive values.
3. You want the 16 byte value in pos 20 with left justified.

Code:

//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,                       
  OVERLAY=(81:1,4,BI,M10,LENGTH=16,20:81,16,JFY=(SHIFT=LEFT)))
/*
Back to top
View user's profile Send private message
knarayan

New User


Joined: 25 Nov 2008
Posts: 9
Location: providence, ri

PostPosted: Mon Jun 22, 2009 11:36 pm    Post subject:
Reply with quote

Thanks Kolusu.. That is fantastic... Quick question though .. what would you change there if you only had a subset of fields required in the INREC. for e.g if i needed to select fields 1,35. then this field was in position 36,4 and then the last field that i needed was in say 60,20. Can you actually use the INREC FIELDS along with this OVERLAY?

Thanks!!
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 Jun 23, 2009 1:09 am    Post subject:
Reply with quote

OVERLAY can be used when you want to replace specific bytes with the same number of bytes without changing the rest of the record.

If you want to reformat the records the way you say, you would need to use BUILD rather than OVERLAY and specify all of the fields you want in the output record. To do what you described, you could use these DFSORT control statements:

Code:

   OPTION COPY                                                     
   INREC IFTHEN=(WHEN=INIT,                                       
    OVERLAY=(81:1,4,BI,M10,LENGTH=16,81:81,16,JFY=(SHIFT=LEFT))), 
   IFTHEN=(WHEN=INIT,BUILD=(1,35,81,16,60,20))                     
Back to top
View user's profile Send private message
knarayan

New User


Joined: 25 Nov 2008
Posts: 9
Location: providence, ri

PostPosted: Wed Jun 24, 2009 1:29 am    Post subject:
Reply with quote

Thanks Frank.. That was helpful
Back to top
View user's profile Send private message
knarayan

New User


Joined: 25 Nov 2008
Posts: 9
Location: providence, ri

PostPosted: Wed Jun 24, 2009 1:34 am    Post subject:
Reply with quote

I wasn't really aware that we could actually pass the data from the first IFTHEN into the second IFTHEN.. DFSORT continues to surprise me
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: Wed Jun 24, 2009 2:14 am    Post subject:
Reply with quote

Yes, you can reprocess records with multiple IFTHEN clauses. Note that OVERLAY can be used to reprocess fields as well. We aim to please! icon_wink.gif
Back to top
View user's profile Send private message
knarayan

New User


Joined: 25 Nov 2008
Posts: 9
Location: providence, ri

PostPosted: Tue Jun 30, 2009 2:30 am    Post subject:
Reply with quote

Frank Yaeger wrote:
Yes, you can reprocess records with multiple IFTHEN clauses. Note that OVERLAY can be used to reprocess fields as well. We aim to please! icon_wink.gif


Hi Frank... quick question. If you need to sort on these overlay fields, how do you specify the sort? I am running into issues when I try to sort the new layout

Thanks
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 Jun 30, 2009 2:43 am    Post subject:
Reply with quote

You asked to convert BI value to left-justified numeric values. You could use UFF format for the resulting values.

For complete details on DFSORT's UFF format, see:

http://www.ibm.com/systems/support/storage/software/sort/mvs/pdug/
Back to top
View user's profile Send private message
knarayan

New User


Joined: 25 Nov 2008
Posts: 9
Location: providence, ri

PostPosted: Tue Jun 30, 2009 3:14 am    Post subject:
Reply with quote

Thanks Frank.. Just wanted to let you know that I am really having fun with the nested ifthen...
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 Jun 30, 2009 3:41 am    Post subject:
Reply with quote

Quote:
Just wanted to let you know that I am really having fun with the nested ifthen


icon_biggrin.gif
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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts the use of 'B3'x character in a panel Pedro TSO/ISPF 1 Thu Feb 16, 2017 3:09 am
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts resume binary ftp in z/os meykh2014 All Other Mainframe Topics 6 Sun Jan 22, 2017 10:01 am


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