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

Convert packed to Alpha Numeric


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jithumohan

New User


Joined: 31 Jan 2008
Posts: 30
Location: Woodland Hills, CA

PostPosted: Fri Feb 08, 2008 4:46 pm
Reply with quote

Can anybody help me to convert a packed decimal variable to an alphanumeric value without zero padding?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Feb 08, 2008 5:07 pm
Reply with quote

What programming language are you using ?
Back to top
View user's profile Send private message
jithumohan

New User


Joined: 31 Jan 2008
Posts: 30
Location: Woodland Hills, CA

PostPosted: Fri Feb 08, 2008 5:08 pm
Reply with quote

SAS in mainframes
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Feb 08, 2008 5:12 pm
Reply with quote

Then read the data into a variable defining it as PDn.

Zero padding is usually off by default
Back to top
View user's profile Send private message
jithumohan

New User


Joined: 31 Jan 2008
Posts: 30
Location: Woodland Hills, CA

PostPosted: Fri Feb 08, 2008 5:18 pm
Reply with quote

Hi please find the below scenario.

Packed Decimal value in the input file = 003
I want to create a report using this file. But the report conatins only 3. I want the data as 003. Please note that the value in the input file is of Packed decimal 9(03) comp-3.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Feb 08, 2008 5:21 pm
Reply with quote

jithumohan wrote:
Can anybody help me to convert a packed decimal variable to an alphanumeric value without zero padding?


Huh ? - You asked for the value without zero padding, and now you want zero padding ?

Which do you really want

3 or 003
Back to top
View user's profile Send private message
jithumohan

New User


Joined: 31 Jan 2008
Posts: 30
Location: Woodland Hills, CA

PostPosted: Fri Feb 08, 2008 5:23 pm
Reply with quote

I am sorry for the first query... Actually I want the data with zeros....
Sorry for my mistake. icon_surprised.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Feb 08, 2008 5:24 pm
Reply with quote

Then use a format for that variable in the report.
Back to top
View user's profile Send private message
jithumohan

New User


Joined: 31 Jan 2008
Posts: 30
Location: Woodland Hills, CA

PostPosted: Fri Feb 08, 2008 5:26 pm
Reply with quote

I tried a lot. Could you help me with an exact syntax?[/list]
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Feb 08, 2008 5:29 pm
Reply with quote

Ok, I will take a look at what you have tried, please post the code you are using to format the data.
Back to top
View user's profile Send private message
jithumohan

New User


Joined: 31 Jan 2008
Posts: 30
Location: Woodland Hills, CA

PostPosted: Fri Feb 08, 2008 5:33 pm
Reply with quote

Input field

@1 PLAN PD2.0

I used the following code for coverting


SAS_PLAN = PUT(PLAN,3.);
CHR_PLAN = SAS_PLAN;

But the output was only '3'.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Feb 08, 2008 5:40 pm
Reply with quote

The SAS default is to remove leading zeros, so you need to use a format that will insert the leading zeros.

My style of coding has changed a lot since working with other people, and this is just a hint that I have picked up on, but I usually define formats at the start of the data step, and then know that the data will be in the format I require when it is written out.
Code:

DATA STEP;
  FORMAT  VAR1    3.
          VAR2   $3.
          VAR3   Z3.;
Back to top
View user's profile Send private message
jithumohan

New User


Joined: 31 Jan 2008
Posts: 30
Location: Woodland Hills, CA

PostPosted: Mon Feb 11, 2008 10:34 am
Reply with quote

Thanks for the help icon_smile.gif .... I got the solution...
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Convert Service Unit to CPU Seconds All Other Mainframe Topics 1
No new posts CONVERT a given date from UTC TO BST CICS 0
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
Search our Forums:

Back to Top