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
 

 

Packed deciaml to aplhanumeric conversion

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Fri Sep 01, 2006 11:34 am    Post subject: Packed deciaml to aplhanumeric conversion
Reply with quote

Hi All,
I am facing a problem. Please help me out of this. The problem is -
I am having some packed decimal variables holding some value. But in the output file, I want to show their value in alphanumeric format. So for that I have to move the values from the packed decimal fields to aljphanumeric fields.

Can you please send me a shortest and easiest way to do that beacause I have to do this for near about 100 variables.
Back to top
View user's profile Send private message

prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Fri Sep 01, 2006 8:01 pm    Post subject:
Reply with quote

You can move the packed decimal variable to an edited field which can be moved to alphanumeric field. I hope this is what you are looking for.

eg. A PIC 9(03)V9(02)
B PIC 999.99
C PIC X(06)

MOVE A TO B
MOVE B TO C
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Sat Sep 02, 2006 12:45 am    Post subject: Re: Packed deciaml to aplhanumeric conversion
Reply with quote

Why the move from 'B' to 'C'? 'B' is already in a display format.

Also, don't forget to include the sign if negative values are possible.

Dave
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Sep 03, 2006 2:19 am    Post subject:
Reply with quote

Hi Amitava,

You didn't say if the packed fld is signed. And you didn't say what you intend to do with it after the coversion to A/N. I suppose it's signed and you want to display/print it.

If you do, you'll have trouble w/the sign. A pos 123 will display as 12C; a neg 123 as 12L. When you go to display/print it, move to a field defined something like this:

disp-fld pic -999. You'll probably have to also redefine the A/N fld as PIC 999 and move that to the disp-fld.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1226
Location: Israel

PostPosted: Sun Sep 03, 2006 1:10 pm    Post subject:
Reply with quote

If you have to MOVE about 100 variables, you could consider using a
MOVE CORRESPONDING command.
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Thu Sep 07, 2006 9:44 am    Post subject:
Reply with quote

Thanx a lot for your responses. In response to MMWIFE's query,
i. The packed decimal fields can be positive or negetive(That I don't know before) - i.e The packed decimal fields are signed.
ii. These fields will be written to the output file, not for report genearion but just as an output flat-file(which will be used in down-streams.).
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Sep 09, 2006 9:58 am    Post subject:
Reply with quote

Hi Amitava,

If you don't have a need to print the fields it may be best to define them with the same PIC as their COMP-3 senders, but w/o the COMP-3, e.g.:

S9(5)V99 COMP-3 ===> S9(5)V99.
Back to top
View user's profile Send private message
hey_its_me
Warnings : 1

New User


Joined: 23 Aug 2006
Posts: 14
Location: USA

PostPosted: Tue Sep 19, 2006 5:09 pm    Post subject: Re: Packed deciaml to aplhanumeric conversion
Reply with quote

hi,

I sincerely think this fact that i would like to share with my friend, would clarify his/her doubt on the relevant topic.

In the case packed decimals the no of bytes used(the space used by the variable in memory) can be calculatd by a simple formula.

if the variable is defined as S9(n) comp-3, where n is an integer, then the number of bytes used by the variable is given by

((n/2)+1).

Then if you want to display anything which is packed decimal format, then move the value into a numeric variable of the size as per the formula and then move this value to a alphanumeric variable of same type.

If there is any further details regarding the particular topic please be kind enough to share it with me.


Thanks and regards,

Anil Kumar
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Sep 20, 2006 7:37 am    Post subject:
Reply with quote

Hi Anil,

The number of bytes used to house a comp-3 variable is less than its DISPLAY format equivalent, BUT the PIC contains the same # of 9s.
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 -> COBOL Programming 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