MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Conversion Display to packed decimal

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Sat Oct 20, 2007 11:44 am    Post subject: Conversion Display to packed decimal Reply with quote

I have a FB file with LRECL=301.

I need to copy all the data to another file and convert a particular field to packed decimal, other data remains same.
The field starts at 212 and is declared as $zzz,zz9.99.

I appreciate any help!!
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Sat Oct 20, 2007 12:42 pm    Post subject: Reply with quote

vak255
I would suggest you to use SORT, which would be more easy in this scenario.
Let me know if could use SORT 8)
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Sun Oct 21, 2007 7:28 am    Post subject: Reply with quote

vak255
OK, if you want to use COBOL only, then you could create a group like this
Code:
05  INPUT-GROUP.
                  10  FILLER              PIC X.
                  10  NUM1                 PIC 9.
                  10  NUM2                 PIC 9.
                  10  NUM3                 PIC 9.
                  10  FILLER                PIC X.
                  10  NUM4                 PIC 9.
                  10  NUM5                 PIC 9.
                  10  NUM6                 PIC 9.
                  10  FILLER                 PIC X.
                  10  NUM7                 PIC 99.

and another group variable
Code:

05      OUT-GROUP.
                  10  NUM1                 PIC 9.
                  10  NUM2                 PIC 9.
                  10  NUM3                 PIC 9.
                  10  NUM4                 PIC 9.
                  10  NUM5                 PIC 9.
                  10  NUM6                 PIC 9.
                  10  NUM7                 PIC 99.



Now you could move from INPUT-GROUP to OUT-GROUP one by one.
From NUM1 to NUM5 for each variable have a check up if it is not equal to blank, if it is blank move '0' to corresponding NUMn.

Once this is done you could move OUT-GROUP to a packed decimal variable.
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Sun Oct 21, 2007 8:22 am    Post subject: Reply with quote

forgot one thing, initialize the OUT-GROUP with ZEROES
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Sun Oct 21, 2007 10:23 am    Post subject: Reply with quote

wonderful, Thanks Kris. I will try it and let you know.
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Sun Oct 21, 2007 1:17 pm    Post subject: Reply with quote

Or
COMPUTE OUT-GROUP = FUNCTION NUMVAL-C (INPUT-GROUP)
where
OUT-GROUP PIC S9(7)V99
should work even easier....
Back to top
View user's profile Send private message
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Sun Oct 21, 2007 7:50 pm    Post subject: Reply with quote

I tried using s9(9)v99 comp-3, but in the output the decimal places are getting truncated,

in input I see $ 3.60.
In output this is getting converted to: 000003(in hex).

Below is the out-group structure that I used.
05 OUT-GROUP.
10 NUM1 PIC 9 comp-3
10 NUM2 PIC 9 comp-3
10 NUM3 PIC 9 comp-3
10 NUM4 PIC 9 comp-3
10 NUM5 PIC 9 comp-3
10 NUM6 PIC 9 comp-3
10 NUM7 PIC 99 comp-3
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Sun Oct 21, 2007 9:41 pm    Post subject: Reply with quote

vak255
Look here for NUMVAL-C usage=>http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3pg30/1.6.6.3?ACTION=MATCHES&REQUEST=NUMVAL-C&TYPE=FUZZY&SHELF=&DT=20050628164603&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Wed Oct 24, 2007 11:18 am    Post subject: Reply with quote

Thanks Kris, it worked great.

Thanks for your time and all the support.
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Wed Oct 24, 2007 12:00 pm    Post subject: Reply with quote

Razz You are welcome, but can you share as to what technique you implemented either group variable or NUMVAL-C.
And How?
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group