View previous topic :: View next topic |
Author |
Message |
manojagrawal Beginner
Joined: 25 Feb 2003 Posts: 124 Topics: 29
|
Posted: Tue Feb 25, 2003 3:30 am Post subject: DB2 -> VSAM -> CICS SMALLINT Display |
|
|
Hi,
I need your help. This is what I am trying to do. Hope you can help me out.
1) I have a DB2 table, say with the following.
Field1 char(4)
Field2 smallint
Field3 char(40)
2) I am first doing an unload of the DB2 table to a flat file. Thus the length of the unload flat file is now 46.
3) I then repro it into a VSAM file. They KEYS are FIELD1 and FIELD2 together.
4) I now want to read this VSAM file from CICS. For that i do a STARTBR and the READNEXT to go through the file.
Now my problem is, when i do this, i am able to display field1 and field3. But I am NOT able to display FIELD2. What do I declare the input as when we do a INTO in the readnext. What should be the datatype of the CICS screen field.
As of now i used PIC '99', for both the screen display and the datatype while reading the file using READNEXT. However, this gives a blank display.
Any kind of help would be very helpful. Thanks!!!!!
Regards,
Manoj. |
|
Back to top |
|
|
santosh_kumar Beginner
Joined: 04 Feb 2003 Posts: 8 Topics: 1
|
Posted: Tue Feb 25, 2003 3:51 am Post subject: |
|
|
Manoj
Smallint in DB2stands for Binary PIC S9(04) COMP in Cobol.So the capacity of the field is 2 power 15 (16 minus 1 (sign bit)).
Your VSAM file layout could be declared as:
Field1 PIC X(4)
Field2 PIC S9(4) COMP
Field3 PIC X(40)
Try using PIC 9(5) for display output.
Hope this helps.
Regards,Santosh |
|
Back to top |
|
|
manojagrawal Beginner
Joined: 25 Feb 2003 Posts: 124 Topics: 29
|
Posted: Tue Feb 25, 2003 4:23 am Post subject: |
|
|
Hi,
I am using PL/I and not cobol.
The second problem is the VSAM length is now 46. However, if i increase the length of the field i read into, will it read from the dataset or will it cos an abend.
It is like this:
DCL TABLE_AREA PIC'(49)X'; 4 + 5 + 40
DCL 1 HELP_CODES BASED (ADDR(TABLE_AREA)),
%INCLUDE MEMBER;; 4 + 5+ 40
the key I use is like:
DCL 1 REC_KEY,
3 RECFLD1 CHAR(4) INIT(LOW(4)),
3 RECFLD2 PIC'99999' INIT(0);
Now, would this read properly from the VSAM.
EXEC CICS STARTBR DATASET('FILENAME')
RIDFLD(REC_KEY);
EXEC CICS READNEXT DATASET('FILENAME')
RIDFLD (REC_KEY)
INTO (TABLE_AREA);
This is what I tried and got an ABEND of AEIV. Any suggestions. Thanks!!!! |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Feb 25, 2003 7:16 am Post subject: |
|
|
manojagrawal,
You can use the scalar function DIGITS for field2 which will give you the output of field2 in character format. The result of the function is a fixed-length character string representing the absolute value of the argument without regard to its scale. The result does not include a sign or a decimal point. Instead, it consists exclusively of digits, including, if necessary, leading zeros to fill out the string. The length of the string is:
- 5 if the argument is a small integer
- 10 if the argument is a large integer
- p if the argument is a decimal number with a precision of p
So use this sql for unloading
Code: |
SELECT FIELD1
,DIGITS(FIELD2)
,FIELD3
..
FROM TABLE
|
Check this link for detailed explanation of DIGITS function
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQ0G3/4.2.24?SHELF=&DT=20010418155454
Hope this helps...
cheers
kolusu |
|
Back to top |
|
|
manojagrawal Beginner
Joined: 25 Feb 2003 Posts: 124 Topics: 29
|
Posted: Thu Feb 27, 2003 6:07 am Post subject: |
|
|
Hi Kolusu,
Thanks!!!! Sure did help!!!
Regards,
Manoj _________________ Thanks & Regards,
Manoj. |
|
Back to top |
|
|
|
|