Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us