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 

DB2 -> VSAM -> CICS SMALLINT Display

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


Joined: 25 Feb 2003
Posts: 124
Topics: 29

PostPosted: Tue Feb 25, 2003 3:30 am    Post subject: DB2 -> VSAM -> CICS SMALLINT Display Reply with quote

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
View user's profile Send private message
santosh_kumar
Beginner


Joined: 04 Feb 2003
Posts: 8
Topics: 1

PostPosted: Tue Feb 25, 2003 3:51 am    Post subject: Reply with quote

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
View user's profile Send private message
manojagrawal
Beginner


Joined: 25 Feb 2003
Posts: 124
Topics: 29

PostPosted: Tue Feb 25, 2003 4:23 am    Post subject: Reply with quote

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


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

PostPosted: Tue Feb 25, 2003 7:16 am    Post subject: Reply with quote

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


Joined: 25 Feb 2003
Posts: 124
Topics: 29

PostPosted: Thu Feb 27, 2003 6:07 am    Post subject: Reply with quote

Hi Kolusu,

Thanks!!!! Sure did help!!!

Regards,
Manoj
_________________
Thanks & Regards,
Manoj.
Back to top
View user's profile Send private message
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