View previous topic :: View next topic |
Author |
Message |
Dip Beginner
Joined: 24 Mar 2006 Posts: 27 Topics: 14
|
Posted: Fri Mar 24, 2006 3:01 pm Post subject: Decimal field(extracted from table) read in a cobol program |
|
|
Field1 : Varchar 15 (not null)
Field2: Decimal 22,7
From the table i am extarcting field1 and field2 in a file. Based on the value of field1
i will NULLIfy the value of 2nd field thru a cobol db2 program
The file layout is coming:
2(len of field1) +15 (text value) +12 (PD format) +1 (NULLIF character) = 30
INFILE :
01 FILEIN-RECORD.
05 FIELD1.
10 FIELD1 PIC S9(4) USAGE COMP.
10 FIELD1-TEXT PIC X(15).
05 FIELD2 PIC ??????
USAGE COMP-3.
Field2 : declaration in DCLGEN PIC S9(15)V9(2) USAGE COMP-3
My logic:
IF FIELD1- TEXT = 'AAA'
MOVE -1 to NULL INDICATOR OF the FIELD2
Else
MOVE THE DATA FROM THE FILE TO DCLGEN
FIELD2 i cant define as PIC S9(15)V9(7) USAGE COMP-3 (exceeding 18 bytes)
[size=18][b]Plaese let me know how can i define/ read field2 and then move to the field2 DCLGEN var ?[/b][/size]
Thanks
Dip |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Mar 24, 2006 7:39 pm Post subject: |
|
|
Quote: |
FIELD2 i cant define as PIC S9(15)V9(7) USAGE COMP-3 (exceeding 18 bytes)
|
Dip,
yes you can define field2 as pic PIC S9(15)V9(7) USAGE COMP-3 as cobol now supports upto 31 digits. Code the following line as first line of your program (before ID division statement
and recompile the program by defining feild2 as PICS9(15)V9(7) COMP-3
Hope this helps..
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|