IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to unpack the packed decimal data using easytrieve


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
hnharish

New User


Joined: 30 Aug 2005
Posts: 23

PostPosted: Tue Nov 11, 2008 4:56 pm
Reply with quote

I have packed decimal data in the input file and i have to unpack the data and write into output file.Ex: If i have a 100.00 dollars amount stored in the packed decimal field after the data is moved into the output field it has to display 100.00 in the readable format.So how to declare the output field.

Ex:
Input File:
FILE FILEIN1 FB(730 27740)
FILEIN1-TOTPYMT 64 8 P

Output File:
FILE FILEIN2 FB(73 0)
FILEIN2-TOTPYMT ?
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Tue Nov 11, 2008 5:02 pm
Reply with quote

Hi,
you can declare the working storage as FILEIN2-TOTPYMT 10 N
Back to top
View user's profile Send private message
hnharish

New User


Joined: 30 Aug 2005
Posts: 23

PostPosted: Tue Nov 11, 2008 5:21 pm
Reply with quote

anandinmainframe wrote:
Hi,
you can declare the working storage as FILEIN2-TOTPYMT 10 N


As mentioned earlier FILEIN1-TOTPYMT 64 8 P corresponds to S9(13)V99 COMP-3 in cobol.So i have to declare FILEIN2-TOTPYMT as FILEIN2-TOTPYMT 48 15 N. But this is not working becuase in the input file if COMP-3 data contains 82.55 in the output i m getting 000000000008255 the decimal dot is missing.
Back to top
View user's profile Send private message
hnharish

New User


Joined: 30 Aug 2005
Posts: 23

PostPosted: Tue Nov 11, 2008 5:42 pm
Reply with quote

hnharish wrote:
anandinmainframe wrote:
Hi,
you can declare the working storage as FILEIN2-TOTPYMT 10 N


As mentioned earlier FILEIN1-TOTPYMT 64 8 P corresponds to S9(13)V99 COMP-3 in cobol.So i have to declare FILEIN2-TOTPYMT as FILEIN2-TOTPYMT 48 15 N. But this is not working becuase in the input file if COMP-3 data contains 82.55 in the output i m getting 000000000008255 the decimal dot is missing.


Also if i declare
FILEIN2-TOTPYMT 48 15 N MASK(A '9999999999999.99')
and display the data in the FILEIN2-TOTPYMT i m getting proper result i'e., 0000000000082.55.But in the output file i m getting 000000000008255 the decimal dot is missing.
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Tue Nov 11, 2008 6:20 pm
Reply with quote

Hi,
Declare this as FILEIN2-TOTPYMT 48 15 N 2
Back to top
View user's profile Send private message
hnharish

New User


Joined: 30 Aug 2005
Posts: 23

PostPosted: Tue Nov 11, 2008 6:25 pm
Reply with quote

anandinmainframe wrote:
Hi,
Declare this as FILEIN2-TOTPYMT 48 15 N 2


This is also giving the result 000000000825500 here also the dot is missing.I think we have to look for any alphanumeric data type like x in cobol.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Nov 12, 2008 4:25 am
Reply with quote

Hello,

To do what you want, use change your MASK.

Try 'ZZZZZZZZZZZ9.99' and adjust if you want punctuation with commas or if you want a minus sign.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Nov 12, 2008 11:21 am
Reply with quote

Hi Harish,

I believe easytrieve as such cannot generate signs/decimal points by itself while writing to a file and we need to provide them explicitly. I ran a small test and that worked fine for me. May be you can give it a try.

Code:
    FILE INFILEI1                                     
        IN-REC                1   80   A             
        IN-COST               1    8   P             
        FILLER-1              9   72   A             
                                                       
    FILE OUTFILE1                                     
        OUT-REC               1   80   A               
        OUT-COST              1   16   A               
                                                       
     WS-COST                       W  15   N           
        COSTA WS-COST                 13   N           
        COSTB WS-COST             +13  2   N           
     WS-COST-D                     W  16   A           
        COSTX     WS-COST-D           13   A           
        COSTD     WS-COST-D       +13  1   A  VALUE '.'
        COSTY     WS-COST-D       +14  2   A           
*                                                     
JOB INPUT(INFILEI1)                                   
WS-COST     =  IN-COST                                 
COSTX       =  COSTA                                   
COSTY       =  COSTB                                   
OUT-COST    =  WS-COST-D   
PUT OUTFILE1   

INFILEI1
Code:
IN-COST          FILLER
8/P              72/AN
(1-8)            (9-63)
1--------------- 2-----
***********************
1234567890123.45   

OUTFILE1
Code:
1234567890123.45
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Wed Nov 12, 2008 3:55 pm
Reply with quote

Hi,
If FILEIN1-TOTPYMT 64 8 P 2 then if you give declare
FILEIN2-TOTPYMT 48 15 N 2 then it will do what you want.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
Search our Forums:

Back to Top