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 packed to Alpha Numeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 08, 2008 5:07 pm    Post subject:
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    Post subject:
Reply with quote

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

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 08, 2008 5:12 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 08, 2008 5:21 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 08, 2008 5:24 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 08, 2008 5:29 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 08, 2008 5:40 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm


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