IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

I am getting file status code 04 while reading VSAM file ?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Fri May 14, 2010 2:57 pm
Reply with quote

Start statement successfully executed,but while Read Vasam file iam getting file status= 04.

START TPU-INPUT-FILE KEY IS >= RTI-VSAM-KEY

READ TPU-INPUT-FILE NEXT RECORD.

Vsam key is below,

05 RTI-VSAM-KEY.
10 RTI-ACCOUNT-NUM.
15 ACCNUM PIC X(10) VALUE SPACES.
15 FILLER PIC X(24) VALUE SPACES.
10 RTI-AMOUNT PIC 9(12)V9(2) COMP-3 VALUE ZEROS.
10 RTI-HLD-SQN PIC 9(05) VALUE ZEROS.
10 ITEM-COUNTER PIC 9(05) VALUE ZEROS.


INITIALIZE RTI-VSAM-KEY.

MOVE DEPOSIT-ACCT-FULL TO ACCNUM.
MOVE WS-RTI-TRAN-AMOUNT TO RTI-AMOUNT.

START TPU-INPUT-FILE KEY IS >= RTI-VSAM-KEY

READ TPU-INPUT-FILE NEXT RECORD.

Please sugget me how to solve this?
Back to top
View user's profile Send private message
icetigerfan

New User


Joined: 08 Mar 2010
Posts: 13
Location: Nuremberg, Germany

PostPosted: Fri May 14, 2010 3:25 pm
Reply with quote

Hi,

you will find this description in the Language Reference:
Quote:
A READ statement was successfully executed, but the length of the
record being processed did not conform to the fixed file attributes
for that file.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri May 14, 2010 4:17 pm
Reply with quote

Fix your code to have the right record length for the file.
Back to top
View user's profile Send private message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Fri May 14, 2010 4:21 pm
Reply with quote

i saw the description in file status manual,but i am expecting why i am getting file status 04 and how can i solve this problem.please tell me is there any change in my code?
Back to top
View user's profile Send private message
icetigerfan

New User


Joined: 08 Mar 2010
Posts: 13
Location: Nuremberg, Germany

PostPosted: Fri May 14, 2010 4:25 pm
Reply with quote

The error may be in your JCL (if it's a Batch-Programm)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri May 14, 2010 4:30 pm
Reply with quote

icetigerfan,

the file in question is a VSAM (assume KSDS), which means little or no DCB parms are contained in the JCL for the step.

The TS's (Topic Starter) record descriptions in the FD statement are what Robert is suggesting that should be corrected.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri May 14, 2010 4:40 pm
Reply with quote

Quote:
.please tell me is there any change in my code?
How on earth would we know this? You wrote the code, presumably, so you should know if it changed?

Do a LISTCAT ENT(???) ALL on your VSAM file. Compare the file definition to your program's data map to see how they compare. If you still cannot find the problem, post the entire LISTCAT output and the VSAM file data map and we'll help identify the problem.
Back to top
View user's profile Send private message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Fri May 14, 2010 7:42 pm
Reply with quote

Hi Robert,

i have compared LISTCAT entries and my fiel definition in my program.Both lengths are same,but still i am getting same error.

VSAM program fields in my program below,

Code:
  ********************** Top of Data ******************************
01 RTI-5DAY-VSAMFILE.                                           
    05 RTI-VSAM-KEY.                                             
       10 RTI-ACCOUNT-NUM      PIC X(34) VALUE SPACES.           
       10 RTI-AMOUNT           PIC 9(12)V9(2) COMP-3 VALUE ZEROS.
       10 RTI-HLD-SQN          PIC 9(05) VALUE ZEROS.           
       10 ITEM-COUNTER         PIC 9(05) VALUE ZEROS.           
    05 RTI-CAPT-DTE            PIC 9(08) VALUE ZEROS.           
    05 RTI-ACTION              PIC X(01) VALUE SPACES.           
    05 RTI-VALUE-DTE           PIC 9(08) VALUE ZEROS.           
    05 RTI-EXPIRE-DTE          PIC 9(08) VALUE ZEROS.           
    05 RTI-HLD-TYPE            PIC X(01) VALUE SPACES.           
    05 RTI-STATUS              PIC X(01) VALUE SPACES.           
********************* Bottom of Data **************************** 

each fields length details below,
Code:
--------- FIELD LEVEL/NAME ---------- -PICTURE- -NUMBER START     END  LENGTH 
RTI-5DAY-VSAMFILE                                           1      79      79 
5 RTI-VSAM-KEY                        GROUP          1      1      52      52 
  10 RTI-ACCOUNT-NUM                  X(34)          2      1      34      34 
  10 RTI-AMOUNT                       9(12)V99       3     35      42       8 
  10 RTI-HLD-SQN                      9(5)           4     43      47       5 
  10 ITEM-COUNTER                     9(5)           5     48      52       5 
5 RTI-CAPT-DTE                        9(8)           6     53      60       8 
5 RTI-ACTION                          X              7     61      61       1 
5 RTI-VALUE-DTE                       9(8)           8     62      69       8 
5 RTI-EXPIRE-DTE                      9(8)           9     70      77       8 
5 RTI-HLD-TYPE                        X             10     78      78       1 
5 RTI-STATUS                          X             11     79      79       1 
******************************* Bottom of data ******************************** 

Code:
LISTCAT ENTRIES(ITA16D.RTI50.VSAM.CLUSTER1) ALL                       00070001
CLUSTER ------- ITA16D.RTI50.VSAM.CLUSTER1                                     
     IN-CAT --- ICFCTLG.DEVCT3                                                 
     HISTORY                                                                   
       DATASET-OWNER-----ITE92D     CREATION--------2010.134                   
       RELEASE----------------2     EXPIRATION------0000.000                   
     SMSDATA                                                                   
       STORAGECLASS ---SCNOGRSP     MANAGEMENTCLASS-MCNORLSE                   
       DATACLASS --------(NULL)     LBACKUP ---0000.000.0000                   
       BWO STATUS------00000000     BWO TIMESTAMP---00000 00:00:00.0           
       BWO---------------(NULL)                                                 
     RLSDATA                                                                   
       LOG ----------------(NULL)   RECOVERY REQUIRED --(NO)     FRLOG ---------
       VSAM QUIESCED -------(NO)    RLS IN USE ---------(NO)                   
       LOGSTREAMID-----------------------------(NULL)                           
       RECOVERY TIMESTAMP LOCAL-----X'0000000000000000'                         
       RECOVERY TIMESTAMP GMT-------X'0000000000000000'                         
     PROTECTION-PSWD-----(NULL)     RACF----------------(NO)                   
     ASSOCIATIONS                                                               
       DATA-----ITA16D.RTI50.VSAM.CLUSTER1.DATA                                 
       INDEX----ITA16D.RTI50.VSAM.CLUSTER1.INDEX                               
   DATA ------- ITA16D.RTI50.VSAM.CLUSTER1.DATA                                 
     IN-CAT --- ICFCTLG.DEVCT3                                                 
     HISTORY                                                                   
       DATASET-OWNER-----(NULL)     CREATION--------2010.134                   
       RELEASE----------------2     EXPIRATION------0000.000                   
       ACCOUNT-INFO-----------------------------------(NULL)                   
     PROTECTION-PSWD-----(NULL)     RACF----------------(NO)                   
     ASSOCIATIONS                                                               
       CLUSTER--ITA16D.RTI50.VSAM.CLUSTER1                                     
     ATTRIBUTES                                                                 
       KEYLEN----------------52     AVGLRECL--------------79     BUFSPACE-------
       RKP--------------------0     MAXLRECL--------------79     EXCPEXIT-------
       SHROPTNS(1,3)   RECOVERY     UNIQUE           NOERASE     INDEXED       N
       UNORDERED        NOREUSE     NONSPANNED                                 
     STATISTICS                                                                 
       REC-TOTAL--------------5     SPLITS-CI--------------0     EXCPS----------
       REC-DELETED------------0     SPLITS-CA--------------0     EXTENTS--------
       REC-INSERTED-----------0     FREESPACE-%CI----------0     SYSTEM-TIMESTAM
            REC-UPDATED------------0     FREESPACE-%CA----------0          X'C5F9A1F0
       REC-RETRIEVED----------3     FREESPC----------4128768                   
     ALLOCATION                                                                 
       SPACE-TYPE------CYLINDER     HI-A-RBA---------4147200                   
       SPACE-PRI--------------5     HI-U-RBA----------829440                   
       SPACE-SEC--------------1                                                 
     VOLUME                                                                     
       VOLSER------------DEV786     PHYREC-SIZE--------18432     HI-A-RBA-------
IDCAMS  SYSTEM SERVICES                                           TIME: 09:35:43
       DEVTYPE------X'3010200F'     PHYRECS/TRK------------3     HI-U-RBA-------
       VOLFLAG------------PRIME     TRACKS/CA-------------15                   
       EXTENTS:                                                                 
       LOW-CCHH-----X'01600000'     LOW-RBA----------------0     TRACKS---------
       HIGH-CCHH----X'0164000E'     HIGH-RBA---------4147199                   
   INDEX ------ ITA16D.RTI50.VSAM.CLUSTER1.INDEX                               
     IN-CAT --- ICFCTLG.DEVCT3                                                 
     HISTORY                                                                   
       DATASET-OWNER-----(NULL)     CREATION--------2010.134                   
       RELEASE----------------2     EXPIRATION------0000.000                   
     PROTECTION-PSWD-----(NULL)     RACF----------------(NO)                   
     ASSOCIATIONS                                                               
       CLUSTER--ITA16D.RTI50.VSAM.CLUSTER1                                     
     ATTRIBUTES                                                                 
       KEYLEN----------------52     AVGLRECL---------------0     BUFSPACE-------
       RKP--------------------0     MAXLRECL------------1017     EXCPEXIT-------
       SHROPTNS(1,3)   RECOVERY     UNIQUE           NOERASE     NOWRITECHK     
       NOREUSE                                                                 
     STATISTICS                                                                 
       REC-TOTAL--------------1     SPLITS-CI--------------0     EXCPS----------
       REC-DELETED------------0     SPLITS-CA--------------0     EXTENTS--------
       REC-INSERTED-----------0     FREESPACE-%CI----------0     SYSTEM-TIMESTAM
       REC-UPDATED------------0     FREESPACE-%CA----------0          X'C5F9A1F0
       REC-RETRIEVED----------0     FREESPC------------66560                   
     ALLOCATION                                                                 
       SPACE-TYPE---------TRACK     HI-A-RBA-----------67584                   
       SPACE-PRI--------------2     HI-U-RBA------------1024                   
       SPACE-SEC--------------4                                                 
              VOLSER------------DEV786     PHYREC-SIZE---------1024     HI-A-RBA-------
              DEVTYPE------X'3010200F'     PHYRECS/TRK-----------33     HI-U-RBA-------
              VOLFLAG------------PRIME     TRACKS/CA--------------1                   
              EXTENTS:                                                                 
              LOW-CCHH-----X'00460009'     LOW-RBA----------------0     TRACKS---------
              HIGH-CCHH----X'0046000A'     HIGH-RBA-----------67583                   
       IDCAMS  SYSTEM SERVICES                                           TIME: 09:35:43
                THE NUMBER OF ENTRIES PROCESSED WAS:                                   
                          AIX -------------------0                                     
                          ALIAS -----------------0                                     
                          CLUSTER ---------------1                                     
                          DATA ------------------1                                     
                          GDG -------------------0                                     
                          INDEX -----------------1                                     
                          NONVSAM ---------------0                                     
                          PAGESPACE -------------0                                     
                          PATH ------------------0                                     
                          SPACE -----------------0                                     
                          USERCATALOG -----------0                                     
                          TAPELIBRARY -----------0                                     
                          TAPEVOLUME ------------0                                     
                          TOTAL -----------------3                                     
                THE NUMBER OF PROTECTED ENTRIES SUPPRESSED WAS 0                       
       IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0                       
                                                                                       
IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0             
Code'd
Please help me,how to solve this error?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sat May 15, 2010 2:30 am
Reply with quote

babu_hi wrote:
Vsam key is below,

05 RTI-VSAM-KEY.
10 RTI-ACCOUNT-NUM.
15 ACCNUM PIC X(10) VALUE SPACES.
15 FILLER PIC X(24) VALUE SPACES.
10 RTI-AMOUNT PIC 9(12)V9(2) COMP-3 VALUE ZEROS.
10 RTI-HLD-SQN PIC 9(05) VALUE ZEROS.
10 ITEM-COUNTER PIC 9(05) VALUE ZEROS.


babu_hi wrote:
Code:
  ********************** Top of Data ******************************
01 RTI-5DAY-VSAMFILE.                                           
    05 RTI-VSAM-KEY.                                             
       10 RTI-ACCOUNT-NUM      PIC X(34) VALUE SPACES.           
       10 RTI-AMOUNT           PIC 9(12)V9(2) COMP-3 VALUE ZEROS.
       10 RTI-HLD-SQN          PIC 9(05) VALUE ZEROS.           
       10 ITEM-COUNTER         PIC 9(05) VALUE ZEROS.           
    05 RTI-CAPT-DTE            PIC 9(08) VALUE ZEROS.           
    05 RTI-ACTION              PIC X(01) VALUE SPACES.           
    05 RTI-VALUE-DTE           PIC 9(08) VALUE ZEROS.           
    05 RTI-EXPIRE-DTE          PIC 9(08) VALUE ZEROS.           
    05 RTI-HLD-TYPE            PIC X(01) VALUE SPACES.           
    05 RTI-STATUS              PIC X(01) VALUE SPACES.           
********************* Bottom of Data ****************************


There is a slight difference between the 2 definitions you gave us,
so I suspect you are not really showing us what's in your program. icon_evil.gif

Show us the FILE SECTION just as it is in your program: the FD and the 01 which is after it.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat May 15, 2010 3:31 am
Reply with quote

Since the LISTCAT output looks good and matches the program code, you need to dump the file (there's only 5 records in it) using IDCAMS to see what the data records look like. If you could post the DUMP command output, that will help.

You've got other problems (such as the INDEX CISIZE is too small) but let's deal with one thing at a time.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat May 15, 2010 7:37 am
Reply with quote

Just in the off-chance, what is your DD statement in the step?
Back to top
View user's profile Send private message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Mon May 17, 2010 10:16 am
Reply with quote

Please find my dump command output,

*0001845969 *
* ........000010000120100501A201*
*0050120100501AA *

000000000869257FF0F0F0F0F1F0F0F0F0F1
*0001845969 *
* ......."000010000120100501A201*
*0050120100501AA *

000000000869257FF0F0F0F0F2F0F0F0F0F2
*0001845969 *
* ......."000020000220100501A201*
*0050120100501AA *

000000000069257FF0F0F0F0F1F0F0F0F0F1
*0202741958 *
* ......."000010000120100501A201*
*0050120100501AA *

000000000009257FF0F0F0F0F1F0F0F0F0F1
*0751021105 *
* ......."000010000120100501A201*
*0050120100501AA *

and dd statement in my jcl is for this VSAM input file is

//RTI5DA3I DD DSN=ITA16D.RTI50.VSAM.CLUSTER1,DISP=SHR
Back to top
View user's profile Send private message
icemanroh

New User


Joined: 23 Aug 2008
Posts: 25
Location: Mumbai

PostPosted: Mon May 17, 2010 12:24 pm
Reply with quote

I hope you are not getting any error code when you are opening this file. Just try below & let me know if it works for you.

Add another 01 level in your FD section & keep its length equal to avg length of the VSAM file.
Back to top
View user's profile Send private message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Mon May 17, 2010 1:59 pm
Reply with quote

Problem got solved and it working fine now....Thanks for all replies.
Back to top
View user's profile Send private message
icemanroh

New User


Joined: 23 Aug 2008
Posts: 25
Location: Mumbai

PostPosted: Mon May 17, 2010 2:06 pm
Reply with quote

Did you try to recompile a COBOL VS II components with E-Cobol?

In that case, at the very begining you would've got the error code 39. Then you would've fixed the length but when reading a record you got 04. This happens because E cobol is different for older cobol versions.

OPEN statement failing for VSAM files (file status 39)
In OS/VS COBOL, the RECORDSIZE defined in your VSAM files associated with IDCAMS was not required to match your COBOL program for a successful OPEN. In Enterprise COBOL they must match. The following rules apply to VSAM ESDS, KSDS, and RRDS file definitions:

ESDS and KSDS VSAM
Rule: RECORDSIZE(avg,m) is specified where avg is the average size of the COBOL records, and is strictly less than m; m is greater than or equal to the maximum size of a COBOL record.

RRDS VSAM
Rule: RECORDSIZE(n,n) is specified where n is greater than or equal to the maximum size of a COBOL record.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 17, 2010 4:16 pm
Reply with quote

babu_hi wrote:
Problem got solved and it working fine now....Thanks for all replies.


glad that it is solved. would be helpful to others if you could explain the resolution.
Back to top
View user's profile Send private message
icemanroh

New User


Joined: 23 Aug 2008
Posts: 25
Location: Mumbai

PostPosted: Mon May 17, 2010 4:38 pm
Reply with quote

I am assuming that the problem was a result of Ecobol recompilation. As I posted earlier that the file length has to be matched in Cobol program.

This only resolves the open error. But when you try to read the file it produces 04. Why? because even though the VSAM file is variable the ecobol program still treats it as a FB file. So the simplest way you make the program understand that it is not a FB file but a VB file is to declare another 01 level.

Hope this helps.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue May 18, 2010 11:56 am
Reply with quote

babu_hi wrote:
Problem got solved and it working fine now....Thanks for all replies.
What was wrong ?
It's not just out of curiosity: if the problem was somewhere else we didn't mention, we too can learn something new.
Back to top
View user's profile Send private message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Tue May 18, 2010 12:14 pm
Reply with quote

I have mentioned another 01 level in my program as suggested by Rohit and recompiled again then problem got resolved.

Thanks
Bab
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue May 18, 2010 2:50 pm
Reply with quote

babu_hi,

the other 01 level in your program that you added.
What is the length of this new record?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top