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
 

 

Padding Zeroes while Conversion

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

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Sat Jul 07, 2012 8:19 pm    Post subject: Padding Zeroes while Conversion
Reply with quote

Hi,
I am trying to pad zeroes while converting a field using DFSORT.
Code:
INREC  FIELDS=(1:1,3,PD,TO=FS,LENGTH=02)   

How do I make the output to be padded with zeroes when there are one byte value.
Code:
1 as
01

Is it possible to use UFF, M11 formatting in INREC FIELDS while converting?
Back to top
View user's profile Send private message

HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Sun Jul 08, 2012 12:00 am    Post subject: Reply to: Padding Zeroes while Conversion
Reply with quote

How to handle for more than 2 bytes? For example

Code:
Input: is Char
1
12
123

Output: should be numeric
001
012
123
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Sun Jul 08, 2012 4:09 am    Post subject:
Reply with quote

Use an EDIT nask.
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Sun Jul 08, 2012 3:26 pm    Post subject: Reply to: Padding Zeroes while Conversion
Reply with quote

Achieved it through EDIT Function.
Code:
INREC  FIELDS=(1:1,3,PD,EDIT=(TT)) 

Thanks Bill.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Sun Jul 08, 2012 4:25 pm    Post subject:
Reply with quote

No problem.

I only looked quickly at your control cards before.

Your input is not CH(ar). It is PD (Packed Decimal). It is three bytes long, which for packed decimal means a maximum value of 99999. You may be loosing digits, depending on your data. Also, you know whether or not your data might be negative. If yes, then you are loosing that with your EDIT.

With what you are showing at the moment, you have a potentially signed 5-digit number that you are making, as your entire output, a two-digit unsigned number.
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Mon Jul 09, 2012 12:46 pm    Post subject: Reply to: Padding Zeroes while Conversion
Reply with quote

That's True.

In my case, the field will not have a negative value.
The max value will be of 1 byte which I am making into 2 bytes for DFSORT join key purpose.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jul 09, 2012 7:03 pm    Post subject:
Reply with quote

Hello,

Quote:
The max value will be of 1 byte which I am making into 2 bytes for DFSORT join key purpose.
Sounds like there is still confusion. . .

If you have 1 packed-decimal byte, it will only have 1 digit (plus the sign). If you have 2 packed-decimal bytes, there will be 3 digits plus the sign. Your example shows 1-3 digit input and the output is 3 bytes. . .

Where does the 2 bytes come into the picture?
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Mon Jul 09, 2012 8:11 pm    Post subject: Reply to: Padding Zeroes while Conversion
Reply with quote

I quoted the 3 bytes example for information purpose.

Sign is not of my significance for now.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jul 09, 2012 8:44 pm    Post subject:
Reply with quote

Hello,

Quote:
Sign is not of my significance for now.
You may not believe it matters now, but it does. . . It IS in the data and you have no control over that. Packed-decimal data always has a sign. . .

Please re-read my previous post and clarify just exactly what you want as output - show some realistic input data and the output you want from that input data.
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Mon Jul 09, 2012 10:36 pm    Post subject: Reply to: Padding Zeroes while Conversion
Reply with quote

@dick scherrer, it is always positive, for my case, so I didn't pay heed to it.

Will post the hex value.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jul 09, 2012 11:42 pm    Post subject:
Reply with quote

Hello,

Quote:
it is always positive, for my case, so I didn't pay heed to it.
The issue is not so much whether the value is positive or not - it is the issue of how many digits are contained in the value.

A 1-byte packed-decimal value has only 1 digit. A 2-byte packed-decimal value has 3 digits.
Quote:
The max value will be of 1 byte which I am making into 2 bytes for DFSORT join key purpose.
This cannot happen as one byte will not give 2 digits . . . icon_confused.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Jul 10, 2012 5:07 am    Post subject:
Reply with quote

HameedAli,

To be certain of getting the correct help, you need to use the correct terminology or more words if you are not sure of the terminology.

You see to be using the word "byte" at times when you mean character/digit.

You have shown a three-byte signed packed-decimal field from which you are creating your output field which is two characters/digits with leading zeros where necessary.

If you are trying to say that the packed-decimal field is unsigned, then look in the manual to see how to define it correctly.

If you are saying the field can only hold a single significant digt, 0-9, then include information like that in your initial post.

When posting requests for help, please use the actual definitions you are interested in, as advice can be very specific and we do not care to waste our time because you haven't taken care to give all the information, and word the request the best you can.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jul 10, 2012 8:26 am    Post subject:
Reply with quote

Hello,

Also, keep in mind that an "unsigned" packed-decimal field still Has a sign. By definition, a packed-decimal field reserves the low-order half-byte (nibble) for the sign - even if it is not needed by the code referencing the field.

Posting some values of your "input" field in hex would also help.
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Tue Jul 10, 2012 12:30 pm    Post subject: Reply to: Padding Zeroes while Conversion
Reply with quote

Quote:
If you are saying the field can only hold a single significant digt, 0-9, then include information like that in your initial post.


This is what, I should have mentioned. Will take care of it future posts, thank you.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jul 10, 2012 8:53 pm    Post subject: Reply to: Padding Zeroes while Conversion
Reply with quote

You're welcome - good luck icon_smile.gif

d
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 File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Conversion of a VB file to FB. isssal DFSORT/ICETOOL 1 Mon Oct 31, 2016 10:23 pm
No new posts EBCDIC to ASCII conversion using OCOPY mistah kurtz All Other Mainframe Topics 5 Tue Sep 06, 2016 2:26 pm
No new posts Comparex utility to Syncsort conversion mistah kurtz SYNCSORT 11 Fri Jul 22, 2016 1:53 pm
No new posts changing z/os unicode conversion service meykh2014 All Other Mainframe Topics 0 Tue Jul 12, 2016 10:49 am


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