Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Problem with reading VB file - error code 04.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
bijoybabu83

New User


Joined: 15 Jan 2007
Posts: 36
Location: Kerala

PostPosted: Fri Nov 20, 2009 8:59 pm    Post subject: Problem with reading VB file - error code 04.
Reply with quote

I have a program reading a blocked vb file. The execuction is failing due to read error. The file status code is 04 which denotes a length mismatch between the vb file and the fd entry for the file record.

The following is the fd entry for the file :-

Code:
FD  PCFORMT                                                 
    RECORDING MODE IS V                                     
    BLOCK  CONTAINS  21104 CHARACTERS                       
    RECORD CONTAINS 1636  TO 20996  CHARACTERS               
    LABEL  RECORDS  ARE STANDARD                             
    DATA RECORD IS IN-SUB-XTRCT-REC.                         
                                                             
01  IN-SUB-XTRCT-REC.                                       
    05 IN-FIRST-BYTE             PIC X(01).                 
    05 FILLER                    PIC X(04).                 
    05 IN-TOTAL-COUNT            PIC X(07).                 
    05 FILLER                    PIC X(12).                 
    05 IN-SUB-NUMBER             PIC X(0013).               
    05 FILLER                    PIC X(1594).               
    05 IN-DEPENDENT-CNT          PIC 9(5).                   
       88  IN-DEP-CNT-VALID             VALUE 0 THRU 20.     
    05 IN-DEPENDENT-DATA OCCURS 0 TO 20 TIMES DEPENDING ON   
                         IN-DEPENDENT-CNT INDEXED BY PINIDX.
       10 FILLER                    PIC X(0968).             

Code'd
This is the file read code :-
Code:
READ PCFORMT.                                     
                                                   
EVALUATE PCFRMT-FL-STAT                           
   WHEN 00                                         
      CONTINUE                                     
   WHEN 10                                         
      MOVE  'Y'   TO   END-OF-FILE                 
      GO TO 8999-EXIT                             
   WHEN OTHER                                     
            DISPLAY '*****************************'     
      DISPLAY '**  PCFRMT     FILE  INIT  **'     
      DISPLAY '**      READ ERROR         **'     
      DISPLAY '**  FILE STATUS IS ' PCFRMT-FL-STAT
      DISPLAY '*****************************'     
      CALL 'CANCEL' USING CC-0020                 
END-EVALUATE.                                     


The error sysout it gives is :-
The system or user abend U 020 R=NULL was issued.
From compile unit I290013T at entry point I290013T at compile unit offset +0000FF7E at address 0017AFE.

I looked for the offset in the IDIREPT(may be dump) :-

Code:
Offset Hex            Instruction                   
------ -------------- ------------------------------
   -2C 9620 9000      OI    0(R9),32               
   -28 5830 8024      L     R3,36(,R8)             
   -24 9160 3000      TM    0(R3),96               
   -20 4780 B18A      BC    8,394(,R11)             
   -1C 9610 9000      OI    0(R9),16               
   -18 9180 C2AF      TM    687(R12),128           
   -14 4780 B194      BC    8,404(,R11)             
   -10 0B02           BSM   0,R2                   
    -E 18EA           LR    R14,R10                 
    -C 9807 8014      LM    R0,R7,20(R8)           
    -8 989B 8038      LM    R9,R11,56(R8)           
    -4 5880 8034      L     R8,52(,R8)             
 ***** 07FE           BCR   15,R14                 
    +2 18BE           LR    R11,R14                 
    +4 9120 1000      TM    0(R1),32               
    +8 4770 B012      BC    7,18(,R11)             
    +C 58E0 1008      L     R14,8(,R1)             
   +10 9680 E000      OI    0(R14),128             
   +14 5840 1008      L     R4,8(,R1)               
   +18 185F           LR    R5,R15         

This is what I can see.

Can anybody help me to identify what is the problem

Also I looked for the file attributes :- These are the file attributes.
Code:
Data Set Name . . . . : NPTEST.NASCO.EPZ00074.CORP.FEED.D1006           
                                                                       
General Data                           Current Allocation               
 Management class . . : MCTSTSTD        Allocated tracks  . : 787       
 Storage class  . . . : SCNCTEST        Allocated extents . : 1         
  Volume serial . . . : NCT921                                         
  Device type . . . . : 3390                                           
 Data class . . . . . : DATAV255       Current Utilization             
  Organization  . . . : PS              Used tracks . . . . : 787       
  Record format . . . : VB              Used extents  . . . : 1         
  Record length . . . : 21000                                           
  Block size  . . . . : 27998                                           
  1st extent tracks . : 787                                             
  Secondary tracks  . : 385                                             
  Data set name type  :                 SMS Compressible  :   NO       
                                                                       
  Creation date . . . : 2009/10/06      Referenced date . . : 2009/11/20

Also the file is failing in the reading of the very first record which i can see that has only a size of 52 bytes.

Please help.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Fri Nov 20, 2009 9:12 pm    Post subject:
Reply with quote

Do you see any conflicts between
Quote:
BLOCK CONTAINS 21104 CHARACTERS
and
Quote:
Block size . . . . : 27998
You don't have to specify BLOCK CONTAINS but if you do, it had better be accurate since the program is the first source of DCB data.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Fri Nov 20, 2009 9:15 pm    Post subject: Reply to: Problem with reading VB file - error code 04.
Reply with quote

COBOL2, version/release 4.0 (over 20 years ago), introduced an updated method of reading and writing variable length records in Batch, which has been discussed many times before in the COBOL forum.

Try searching for this, as this updated method (IMHO) is an easier way (and more maintainable and straight forward) than the previous method used in OS/VS COBOL as well as earlier version/releases of COBOL2, prior to 4.0.

Bill
Back to top
View user's profile Send private message
bijoybabu83

New User


Joined: 15 Jan 2007
Posts: 36
Location: Kerala

PostPosted: Fri Nov 20, 2009 9:20 pm    Post subject:
Reply with quote

To Robert,

Actually I used block contains 0 records and submitted the job. It is giving me the same length error.

And then I changed the block size of the file to 21104 by copying the file to another file and putting the new block size to 21104. But still the program gives the same length error
Back to top
View user's profile Send private message
bijoybabu83

New User


Joined: 15 Jan 2007
Posts: 36
Location: Kerala

PostPosted: Fri Nov 20, 2009 9:21 pm    Post subject:
Reply with quote

To Bill O'Boyle,

Can you please provide me some links to this updated method IMHO.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Nov 20, 2009 9:34 pm    Post subject:
Reply with quote

This is what Robert indicated that you should change.

BLOCK CONTAINS 21104 CHARACTERS

don't put a block size in the cobol program!!!!!!!!!!!!!!!!!!!

After the OPEN and before each READ, (experience from old old cobol)
move 20 to IN-DEPENDENT-CNT.

and why don't you use better programming methods (join, at least the 20th century) and use the work-area option. I do realize that you need to move data definitions around. for your record area, you can have 2 01's. One would be PIC X(1636) the other would be PIC X(20996). Then put your current record definition into working-storage.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Fri Nov 20, 2009 9:42 pm    Post subject:
Reply with quote

bijoybabu83 wrote:
To Bill O'Boyle,

Can you please provide me some links to this updated method IMHO.


If you search the Mainframe COBOL forum (as I had suggested), you'll get many hits.

If that doesn't work for you (to quote Robert), "Google is your Friend".

Many members will provide the path, but it's up to you to perform the research....
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Sat Nov 21, 2009 12:40 am    Post subject: increment the size of input copybook
Reply with quote

Please add one more filler add into the last filler cluase.

filller pic x(18396).

then it will match the logic proper way.
Back to top
View user's profile Send private message
bijoybabu83

New User


Joined: 15 Jan 2007
Posts: 36
Location: Kerala

PostPosted: Mon Nov 23, 2009 2:30 pm    Post subject:
Reply with quote

Please let me know why do u want me to add the filler as u said - filller pic x(18396).
Back to top
View user's profile Send private message
bijoybabu83

New User


Joined: 15 Jan 2007
Posts: 36
Location: Kerala

PostPosted: Mon Nov 23, 2009 3:20 pm    Post subject:
Reply with quote

Hi I have one find for you...Something like a doubt.

While defining the fd entry for the variable byte format input file, I defined the input layout as shown :-
RECORDING MODE IS V
BLOCK CONTAINS 0 RECORDS
RECORD CONTAINS 1636 TO 20996 CHARACTERS
LABEL RECORDS ARE STANDARD
DATA RECORD IS IN-SUB-XTRCT-REC.

01 IN-SUB-XTRCT-REC.
05 IN-FIRST-BYTE PIC X(01).
05 FILLER PIC X(04).
05 IN-TOTAL-COUNT PIC X(07).
05 FILLER PIC X(12).
05 IN-SUB-NUMBER PIC X(0013).
05 FILLER PIC X(1594).
05 IN-DEPENDENT-CNT PIC 9(5).
88 IN-DEP-CNT-VALID VALUE 0 THRU 20.
05 IN-DEPENDENT-DATA OCCURS 0 TO 20 TIMES DEPENDING ON
IN-DEPENDENT-CNT INDEXED BY PINIDX.
10 FILLER PIC X(0968).

As you can see the variable part of the input file is determined by the value of IN-DEPENDENT-CNT in the input file. It is defined as a decimal 9(05) field. Whereas the in the input file, there are header records which does have spaces in place of IN-DEPENDENT-CNT. Is this the reason why it is failing with the length error.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Nov 23, 2009 5:40 pm    Post subject:
Reply with quote

I assume that IN-FIRST-BYTE is used to determine the type of record: header, detail ???

second, if you have two distinct types of records:
  • one with the variable length table - detail record?
  • one without - header record
if you create two 01's in your FD -
  • one with the variable length table - detail record?
  • one without - header record
you may have better luck.

this is a very easy task and for someone who has no idea of what he is doing,
you are sure dismissive of suggestions.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us