View previous topic :: View next topic |
Author |
Message |
saraswathi Beginner
Joined: 08 Dec 2006 Posts: 14 Topics: 8
|
Posted: Tue Mar 13, 2007 5:44 am Post subject: Data type conversion in Easytrieve |
|
|
hi,
i need to convert a data which is of binary and packed decimal type into numeric type in easytrieve.Please let me know the ways.
thanks
Saraswathi |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Tue Mar 13, 2007 6:17 am Post subject: |
|
|
saraswathi,
Move them numeric defined variable
Code: |
ws-readable-num w 10 N 0
|
Move your packed and binary values to that variable and it will convert them to readable format.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
saraswathi Beginner
Joined: 08 Dec 2006 Posts: 14 Topics: 8
|
Posted: Tue Mar 13, 2007 7:11 am Post subject: |
|
|
hi,
thanks for your response.but still i am facing a problem.
i have given my code below.
Code: |
FILE INFILE
M-DUNS 01 4 B
M-CCSPCTL 13 2 P
*
*
FILE OUTFILE
O-DUNS 01 9 N
O-CCSPCTL 11 3 N
*
W-DUNS W 9 N
W-CCSPCTL W 3 N
*
JOB INPUT (INFILE)
IF EOF INFILE
STOP
END-IF
MOVE INFILE:M-DUNS TO W-DUNS
MOVE INFILE:M-CCSPCTL TO W-CCSPCTL
MOVE W-DUNS TO OUTFILE:O-DUNS
MOVE W-CCSPCTL TO OUTFILE:O-CCSPCTL
PUT OUTFILE
DISPLAY 'VALUES ' W-DUNS W-CCSPCTL |
The code throws A006 PROGRAM INTERRUPT - CODE 7 (DATA EXCP) error.please clarify this
Thanks,
Saraswathi |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Tue Mar 13, 2007 9:08 am Post subject: |
|
|
saraswathi,
Do not use MOVE statements. You also do not need to check for EOF condition. Easytrieve automatically takes care of EOF when you are using Syncronised file processing. You only need to check for EOF when you are using GET statement.
Your pgm is as simple as this. Mind you will only get positive values since you did not consider the Sign on the output fields definition.
Code: |
FILE INFILE
M-DUNS 01 4 B
M-CCSPCTL 13 2 P
FILE OUTFILE
O-DUNS 01 9 N
O-CCSPCTL 11 3 N
JOB INPUT INFILE
O-DUNS = M-DUNS
O-CCSPCTL = M-CCSPCTL
PUT OUTFILE
DISPLAY 'VALUES ' O-DUNS ' ' O-CCSPCTL
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
saraswathi Beginner
Joined: 08 Dec 2006 Posts: 14 Topics: 8
|
Posted: Tue Mar 13, 2007 11:13 pm Post subject: Data type conversion in Easytrieve |
|
|
thank you very much.it works fine. |
|
Back to top |
|
 |
|
|