View previous topic :: View next topic |
Author |
Message |
vak255 Intermediate

Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
Posted: Sat Oct 20, 2007 11:44 am Post subject: Conversion Display to packed decimal |
|
|
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 |
|
 |
krisprems Beginner

Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
Posted: Sat Oct 20, 2007 12:42 pm Post subject: |
|
|
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 |
|
 |
krisprems Beginner

Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
Posted: Sun Oct 21, 2007 7:28 am Post subject: |
|
|
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 |
|
 |
krisprems Beginner

Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
Posted: Sun Oct 21, 2007 8:22 am Post subject: |
|
|
forgot one thing, initialize the OUT-GROUP with ZEROES _________________ cHEERs
krisprems |
|
Back to top |
|
 |
vak255 Intermediate

Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
Posted: Sun Oct 21, 2007 10:23 am Post subject: |
|
|
wonderful, Thanks Kris. I will try it and let you know. |
|
Back to top |
|
 |
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Sun Oct 21, 2007 1:17 pm Post subject: |
|
|
Or
COMPUTE OUT-GROUP = FUNCTION NUMVAL-C (INPUT-GROUP)
where
OUT-GROUP PIC S9(7)V99
should work even easier.... |
|
Back to top |
|
 |
vak255 Intermediate

Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
Posted: Sun Oct 21, 2007 7:50 pm Post subject: |
|
|
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 |
|
 |
krisprems Beginner

Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
|
Back to top |
|
 |
vak255 Intermediate

Joined: 10 Sep 2004 Posts: 384 Topics: 79
|
Posted: Wed Oct 24, 2007 11:18 am Post subject: |
|
|
Thanks Kris, it worked great.
Thanks for your time and all the support. |
|
Back to top |
|
 |
krisprems Beginner

Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
Posted: Wed Oct 24, 2007 12:00 pm Post subject: |
|
|
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 |
|
 |
|
|