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 

Decimal field(extracted from table) read in a cobol program

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


Joined: 24 Mar 2006
Posts: 27
Topics: 14

PostPosted: Fri Mar 24, 2006 3:01 pm    Post subject: Decimal field(extracted from table) read in a cobol program Reply with quote

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
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Mar 24, 2006 7:39 pm    Post subject: Reply with quote

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

Code:

CBL ARITH(EXTEND)   


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
View user's profile Send private message Send e-mail Visit poster's website
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