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

File Status 4 while reading a VB file


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

New User


Joined: 13 Apr 2007
Posts: 36
Location: Pune

PostPosted: Sun Sep 20, 2009 9:28 am
Reply with quote

Hi,
I am getting a file status of 4 while reading a VB file in a Cobol program.

In the File Section, the record which I had declared is a copybook
(COPY ICPYLOAD)

When I try to display the length of the record read, I get a value of 16444, while the VB file itself is of LRECL = 5100.

However when I replace the copybook declaration with a normal CHAR variable of length 5100, the program runs fine.
Should we not be using a copybook declaration in record description of File Section while reading a VB file?

The program earlier used to process a FB file with the same copybook declaration, but now the FB file has been replaced with a VB file and we are getting this issue. One more thing is that this issue does not come with all the VB files but occasionally.

Now the program is working after replacing the Copybook with a single CHAR variable, but I still don't know why this was happening.

Can someone help me here?

Thanks,
Ashutosh
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sun Sep 20, 2009 10:32 am
Reply with quote

Maybe the copy book is incorrect?

I think the error is line 17 of the copy book.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Sun Sep 20, 2009 10:50 am
Reply with quote

Have you checked the manual to see what a file status of 04 means?
Back to top
View user's profile Send private message
ashutosh.pr

New User


Joined: 13 Apr 2007
Posts: 36
Location: Pune

PostPosted: Sun Sep 20, 2009 3:27 pm
Reply with quote

Yes..it says:
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.

When I display the record length as read by the program it comes to 16444, which means that the value of length being read is incorrect.
I am not sure why this is happening when I specify the copybook and not when I use a single variable.

@Craq
Why do you think it is at line 17.
I do not have the access to the system today so will not be able to verify it.

Thanks!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 21, 2009 1:34 am
Reply with quote

Hello,

Quote:
Why do you think it is at line 17.
Sarcasm. . . As you did not post the content of the copybook, line 17 is as likely as anywhere to be the problem. . .

Suggest you post the select/assign/fd (including the copybook content) as well as the attributes of the file from the system. How is the file created?

Psychic days occur only rarely and almost never on the weekend. For someone here to help, you must provide enough info for people to work with.
Back to top
View user's profile Send private message
Bill Murrell

New User


Joined: 14 Sep 2008
Posts: 10
Location: Oklahoma City, OK

PostPosted: Mon Sep 21, 2009 1:35 am
Reply with quote

What does the RECORDING MODE IS statement in the FD say?

If none present, look for the default value in the manual.
Back to top
View user's profile Send private message
ashutosh.pr

New User


Joined: 13 Apr 2007
Posts: 36
Location: Pune

PostPosted: Tue Sep 22, 2009 12:02 pm
Reply with quote

Hi,
Got access to system today.
Following is the code which is giving error:

Code:
FILE SECTION.                                                         
FD  IN-LOADFLE                                                       
    RECORDING MODE IS  V                                               
    BLOCK  CONTAINS    0 RECORDS                                       
    RECORD VARYING 1 TO 5100 CHARACTERS                               
    DEPENDING ON WS-REC-LENGTH.                                       
    COPY ICPYLOAD.                                                     


-- Copybook Expansion -----
Code:
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
      * ICPYLOAD                                                       *
      *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
       01  ICPY-LD-RECORD.
           05 LD-RECTYPE                 PIC  X(01).
              88 LD-RECTYPE-2               VALUE '2'.
              88 LD-RECTYPE-3               VALUE '3'.
              88 LD-RECTYPE-4               VALUE '4'.
              88 LD-RECTYPE-7               VALUE '7'.
              88 LD-RECTYPE-8               VALUE '8'.
              88 LD-RECTYPE-9               VALUE '9'.
           05 LD-BANK-ID                 PIC  X(08).
           05 LD-BRANCH-ID               PIC  X(04).
              88 LD-BRANCH-SPACES           VALUE '    '.
              88 LD-BRANCH-DELAWARE         VALUE '6301'.
           05 LD-ACCOUNT-ID              PIC  X(35).
           05 LD-ACCOUNT-ID-X REDEFINES LD-ACCOUNT-ID.
              10 LD-ACCOUNT-ID-ECD       PIC  9(15).
              10 LD-ACCOUNT-ID-ECDFILL   PIC  X(20).
           05 LD-EVENT-SEQNUM            PIC S9(09) COMP.
           05 LD-EVENT-REC-SEQNUM        PIC S9(09) COMP.
           05 LD-SUMMARY-BAY-CODE        PIC  X(04).
           05 LD-ITEM-COUNT              PIC S9(09) COMP.
           05 LD-AS-OF-DATE              PIC  X(10).
           05 LD-AS-OF-TIME              PIC  X(08).
           05 LD-AMOUNT                  PIC S9(15)V9(3) COMP-3.
           05 LD-FUNDS-CODE              PIC  X(01).
           05 LD-RECEIVE-TIMESTAMP       PIC  X(26).
           05 LD-CURRENCY-CODE           PIC  X(03).
           05 LD-PRODUCT-GRP-CODE        PIC  X(06).
           05 LD-IMMED-AMOUNT            PIC S9(15)V9(3) COMP-3.
           05 LD-1DAY-AMOUNT             PIC S9(15)V9(3) COMP-3.
           05 LD-2DAY-AMOUNT             PIC S9(15)V9(3) COMP-3.
           05 LD-2DAY-PLUS-AMOUNT        PIC S9(15)V9(3) COMP-3.
           05 LD-3DAY-PLUS-AMOUNT        PIC S9(15)V9(3) COMP-3.
           05 LD-VALUE-DATE              PIC  X(10).
           05 LD-VALUE-TIME              PIC  X(08).
           05 LD-PURGE-DATE              PIC  X(10).
           05 LD-SYSTEM-USER             PIC  X(10).
           05 LD-SYSTEM-TIMESTAMP        PIC  X(26).
      *************************************************************
      *LOADFILE REC FOR  TYPE A REC WILL END HERE - LRECL=242
      *************************************************************
           05 LD-SEQUENCE-NUMBER         PIC  9(09).
           05 LD-POSTING-IND             PIC  X(01).
           05 LD-POSTING-STATUS          PIC  X(02).
           05 LD-FILLER                  PIC  X(07).
           05 LD-TABLE-NUM               PIC  9(02).
           05 LD-BANK-REFERENCE          PIC  X(20).
           05 LD-SRCH-BANK-REF-CD        PIC  X(20).
           05 LD-CUST-REFERENCE          PIC  X(30).
           05 LD-SRCH-CUST-REF-CD        PIC  X(30).
           05 LD-BAY-CODE                PIC  X(04).
              88 LD-ACH-BAY   VALUE '135' '164' '169' '447' '464'
                                      '136' '165' '258' '451' '466'
                                      '142' '166' '286' '455' '468'
                                      '145' '168' '445' '462' '469'
                                      '558'.
              88 LD-CHECK-BAY VALUE '252' '255' '474' '475' '581'.
           05 LD-DRCR-CODE               PIC  X(02).
           05 LD-TRANS-SEQNUM            PIC S9(04) COMP.
           05 LD-DDA-CODE                PIC  X(04).
              88 LD-ZBA-DDACODE             VALUE '045', '091'.
           05 LD-SPREAD-IND              PIC  X(01).
           05 LD-SUMMARY-IND             PIC  X(01).
           05 LD-REPAIR-IND              PIC  X(01).
           05 LD-POST-CODE               PIC  X(01).
           05 LD-SOURCE-CODE             PIC  X(05).
           05 LD-REVERSAL-IND            PIC  X(01).
           05 LD-OVERRIDE-IND            PIC  X(01).
           05 LD-STATUS-CODE             PIC  X(01).
           05 LD-ORIGINAL-DDACODE        PIC  X(08).
           05 LD-FED-RULE-13-IND         PIC  X(01).
           05 LD-DUMMY-REF-NB-IND        PIC  X(01).
           05 LD-THRD-PARTY-IND          PIC  X(01).
           05 LD-ACH-ENTRY-CLASS         PIC  X(04).
           05 LD-UPDATE-TIMESTAMP        PIC  X(26).
           05 LD-SHORT-DESC-TEXT         PIC  X(20).
           05 LD-MTCH-TXN-IN             PIC  X(01).
              88 LD-MATCHED-TXN             VALUE 'Y'.
              88 LD-NOT-MATCHED-TXN         VALUE 'N'.
           05 LD-WIRE-TYPE-CD            PIC  X(01).
           05 LD-WIRE-REF-CD             PIC  X(34).
           05 LD-SRCH-WIRE-REF-CD        PIC  X(20).
           05 LD-CHECK-NB                PIC S9(13) COMP-3.
           05 LD-LKBX-DEP-SEQ-CD         PIC  X(04).
           05 LD-LKBX-ITEMS-QT           PIC S9(07) COMP-3.
           05 LD-LBX-NB                  PIC  X(10).
           05 LD-LKBX-DEP-DT             PIC  X(10).
           05 LD-LBX-DEP-TM              PIC  X(08).
           05 LD-TRANS-REFNUM            PIC  X(12).
           05 LD-CLIENT-REFNUM           PIC  X(20).
           05 LD-DDA350-TEXT             PIC  X(350).
           05 LD-SHORT-NAME              PIC  X(20).
           05 LD-SERIAL-QTY-DATE         PIC  X(11).
           05 LD-SERIAL-QTY-DATE-N REDEFINES LD-SERIAL-QTY-DATE
                                           PIC  9(11).
           05 FILLER REDEFINES LD-SERIAL-QTY-DATE.
              10 LD-DATE-OPEN            PIC S9(07)    COMP-3.
              10 LD-DATE-CLOSE           PIC S9(07)    COMP-3.
              10 LD-ACCT-STATUS          PIC  X(02).
              10 LD-CDA-FLG              PIC  X(01).
           05 LD-MULTI-CLOSE-ENV         PIC  X(01).
           05 LD-MULTI-CLOSE-PENDING-ENV PIC  X(01).
           05 LD-CHECK-FLAG              PIC  X(01).
           05 LD-NONCHECK-FLAG           PIC  X(01).
           05 LD-INTRADAY-FLAG           PIC  X(01).
           05 LD-CD-TEXT-CODE            PIC  X(01).
           05 LD-CD-TEXT-LENGTH          PIC  S9(04) COMP.
      ***********************************************************
      *LOADFILE REC FOR  TYPE B REC WILL END HERE - LRECL=968
      ***********************************************************
           05 LD-EXP-VAR-TEXT            PIC  X(4000).
           05 LD-FILLER2                 PIC  X(132).
      ******************************************************************
      ******************************************************************
      *    END OF COPYBOOK - OVERALL LENGTH = 5100 (NOT INCL. RDW)     *
      ******************************************************************
      ******************************************************************


When I change the File section to below, the error goes off:

Code:
FILE SECTION.                                                         
FD  IN-LOADFILE                                                       
    RECORDING MODE IS  V                                               
    BLOCK  CONTAINS    0 RECORDS                                       
    RECORD VARYING 1 TO 5100 CHARACTERS                               
    DEPENDING ON WS-REC-LENGTH.                                       
01  WS-VAR-5100                   PIC  X(5100) VALUE SPACES.


Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Sep 22, 2009 7:16 pm
Reply with quote

Hello,

Possibly because the record definition in the copybook is not variable. . .
Back to top
View user's profile Send private message
Bill Murrell

New User


Joined: 14 Sep 2008
Posts: 10
Location: Oklahoma City, OK

PostPosted: Tue Sep 22, 2009 8:50 pm
Reply with quote

dick scherrer wrote:
Hello,

Possibly because the record definition in the copybook is not variable. . .


As Dick correctly said the definition is not a variable record. There are two instances where your FD should use variable.
1. When the record description contains an OCCURS n TO x TIMES DEPENDING ON ...
2. When you have more than one record description and their lengths are different. This means you will have more than one level 01 present in that FD.
Back to top
View user's profile Send private message
ashutosh.pr

New User


Joined: 13 Apr 2007
Posts: 36
Location: Pune

PostPosted: Tue Sep 22, 2009 10:55 pm
Reply with quote

Thank you all for your help!!

Thanks,
Ashutosh
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Sep 22, 2009 11:31 pm
Reply with quote

If your problem has been resolved, please share for the benefit of others.
Back to top
View user's profile Send private message
ashutosh.pr

New User


Joined: 13 Apr 2007
Posts: 36
Location: Pune

PostPosted: Wed Sep 23, 2009 3:07 pm
Reply with quote

We sent the code in production with the below changes last week only, as it had to be a quickfix.

Code:
FILE SECTION.                                                         
FD  IN-LOADFILE                                                       
    RECORDING MODE IS  V                                               
    BLOCK  CONTAINS    0 RECORDS                                       
    RECORD VARYING 1 TO 5100 CHARACTERS                               
    DEPENDING ON WS-REC-LENGTH.                                       
01  WS-VAR-5100                   PIC  X(5100) VALUE SPACES.


It is working fine as of now. I believe the suggested approach would be to use 'OCCURS n TO x TIMES DEPENDING ON '.
I tested the code with this and it gave the same correct results.
If some issue crops up, I will update here.

Thanks again for all the help.

-Ashutosh
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Sep 23, 2009 3:16 pm
Reply with quote

Quote:
We sent the code in production with the below changes last week only,...If some issue crops up, I will update here.
Just a suggestion, when you know there is a time-bomb which can blast at any instant, why not do something in time to avoid that instead of waiting something bad to happen.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 23, 2009 7:19 pm
Reply with quote

Hi Anuj,

Unfortunately in some organizations there is a much greater reward for putting out a fire rather than preventing it. . .

Why should things be quietly done right when there is a reward for being the "hero" and fixing the problem at o'dark:30. . .

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

New User


Joined: 14 Sep 2008
Posts: 10
Location: Oklahoma City, OK

PostPosted: Wed Sep 23, 2009 7:25 pm
Reply with quote

And why is there never enough time to do it right the first time, but there is always enough time to do it again when it fails?
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Sep 23, 2009 8:10 pm
Reply with quote

Bill Murrell wrote:
And why is there never enough time to do it right the first time, but there is always enough time to do it again when it fails?
Unfortunately, this has become one of my favorite sayings.
Back to top
View user's profile Send private message
ashutosh.pr

New User


Joined: 13 Apr 2007
Posts: 36
Location: Pune

PostPosted: Wed Sep 23, 2009 11:02 pm
Reply with quote

Thanks for the suggestions....I share the same thoughts but not the authority at times to take decisions.
This time I guess it was system availability to client that was most important.
However, we might go in with the changes prior to the explosion as well icon_biggrin.gif
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