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
 
Finding File status Code without using FileStatus Variable

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

New User


Joined: 13 Jun 2004
Posts: 85

PostPosted: Sat Apr 09, 2005 12:35 am    Post subject: Finding File status Code without using FileStatus Variable
Reply with quote

Hi all,

Is there anyway of finding File status code in a cobol program without using file status variable.

Thanks in advance.
Back to top
View user's profile Send private message

mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Apr 11, 2005 12:36 am    Post subject:
Reply with quote

There may be. Can you give more detail about your problem?
Back to top
View user's profile Send private message
meetsrk

New User


Joined: 13 Jun 2004
Posts: 85

PostPosted: Mon Apr 11, 2005 11:23 am    Post subject: Re: Finding File status Code without using FileStatus Variab
Reply with quote

Normally, we specify the file-status variable in SELECT clause and then declare it in the WORKING-STORAGE SECTION.

Then, after each open/read/write/close statements, we display the file status code to check whether the statement has executed successfully. If not, we check the code and corresponding actions will be taken by us.

Wat i want, is there any possiblity of the finding the file status code without using file status variable in the program ie without specifying FILE STATUS variable in the SELECT clause and also not declaring in the WORKING-STORAGE SECTION.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Apr 13, 2005 6:01 am    Post subject:
Reply with quote

OK, the answer is yes there is a way using cobol's pointer feature to find the DCB associated w/the I/O operation. It can be an involved process. That's why I asked you to tell us what problem you're trying to solve. Or is this just a question that occured to you?
Back to top
View user's profile Send private message
bshkris

New User


Joined: 21 Mar 2005
Posts: 29
Location: pune

PostPosted: Thu Apr 14, 2005 8:53 am    Post subject:
Reply with quote

hi,
i think its not possible. if u get any answer , plz let me know
regard's
hari
Back to top
View user's profile Send private message
subramsa

New User


Joined: 15 Apr 2005
Posts: 16
Location: Bangalore, India

PostPosted: Fri Apr 15, 2005 8:01 pm    Post subject: Re: Finding File status Code without using FileStatus Variab
Reply with quote

Not possible to my knowledge. if anyone has the soultion, would like to know.

Thanks
Sai
Back to top
View user's profile Send private message
learnmf

Active User


Joined: 14 Mar 2005
Posts: 123

PostPosted: Fri Apr 15, 2005 8:05 pm    Post subject:
Reply with quote

HI JACK
Can you explain your answer and about COBOL pointer feature.


Thanks
CHandra
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Apr 17, 2005 9:43 pm    Post subject:
Reply with quote

Hi Chandra,

You can use the POINTER feature to access (but not change) system cntl blocks and data areas.

As I recall the VSAM file status info is stored in the ACB of a VSAM file. You would have to "chain thru the cntl blk pointers to find the ACB.

The COBOL POINTER feature now enables the COBOL pgmr to do this chaining. I've some code below that illustrates the technique.

That being said, it's a long way to go to avoid using the COBOL FILE-STATUS feature. That's why I asked Meetsrk to explain his problem. He didn't do that. He just reiterated his original ques.

What I wanted to know is why he couldn't (or wouldn't) use the FILE-STATUS feature. Some reasons would eliminate the possiblity of using the approach I mentioned. Others my not.

Anyway, here's the code:

It doesn't address this problem specifically, but it does show how to use the POINTER feature to bounce thru the OS.
Code:

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    RUNINFO.
       AUTHOR.        JACK SLEIGHT.
       ENVIRONMENT DIVISION.
      ****************************************************************
      *  DISPLAYS THE FOLLOWING RUN INFO FOR THE CALLING PROGRAM:    *
      *                                                              *
      *       *   PGM/JOB/JOBSTEP/PROCSTEP NAMES                     *
      *       *   ENTRY/LOAD/END POINTS AND LENGTH OF PROGRAM        *
      *                                                              *
      *  FOR COBOL II PROGRAMS ALSO DISPLAYS 4 BYTES OF HEX INDICAT- *
      *  ORS SHOWING THE COMPILE OPTIONS SELECTED AT COMPILE TIME.   *
      ****************************************************************

       CONFIGURATION                   SECTION.
       SOURCE-COMPUTER. IBM-370.
       OBJECT-COMPUTER. IBM-370.
       DATA DIVISION.
       FILE SECTION.

      ****************************************************************
       WORKING-STORAGE                 SECTION.
      ****************************************************************

       01  WS-TCB-ADDR-01.
           10  WS-TCB-ADDR             POINTER.

       01  WS-CVT-ADDR-01.
           10  WS-CVT-ADDR             POINTER.

      ****************************************************************
       01  WS-DISPLAY-FIELDS.
      ****************************************************************
           10  WS-PN-DISPLAY           PIC X(008).
           10  WS-STEP-DISPLAY.
               20 WS-JSTP-NAME         PIC X(008) VALUE "NOT USED".
               20 FILLER               PIC X(001) VALUE "/".
               20 WS-PSTP-NAME         PIC X(008) VALUE "NOT USED".

           10  WS-CTYPE-DISPLAY        PIC X(002).
           10  WS-CREL-DISPLAY         PIC X(005).
           10  WS-CTIME-DISPLAY        PIC X(008).
           10  WS-OPTBYTE-DISPLAY      PIC X(008).

           10  WS-CDATE-DISPLAY        PIC X(012).
           10  REDEFINES WS-CDATE-DISPLAY.
           15  WS-CDATE-DISPLAY-RED.
               20 WS-VSMO-DAY-DISPLAY  PIC X(008).
               20 WS-VSYEAR-DISPLAY    PIC X(004).

           10  WS-EP-DISPLAY           PIC X(008).
           10  WS-LP-DISPLAY           PIC X(008).
           10  WS-FP-DISPLAY           PIC X(008).
           10  WS-LEN-DISPLAY          PIC X(008).

      ****************************************************************
       01  WS-WORK-FIELDS.
      ****************************************************************

           05  WS-ZERO                 PIC 9(009) VALUE 0     COMP.
           05  WS-WORK-FP              PIC 9(009)             COMP.

           05  WS-WORK-PACKED          PIC 9(009)             COMP-3.
           05  REDEFINES WS-WORK-PACKED.
           10  WS-WORK-X5.
               20  WS-WORK-X1          PIC X(001).
               20  WS-WORK-X3          PIC X(003).
           05  REDEFINES WS-WORK-PACKED.
           10  WS-WORK-BIN4            PIC 9(009)     COMP.

           05  WS-WORK-UNPACKED        PIC 9(009).
           05  REDEFINES WS-WORK-UNPACKED.
           10  WS-WORK-UNPACKED-8      PIC 9(008).
1     /
      ****************************************************************
       LINKAGE                         SECTION.
      ****************************************************************

       01  LK-TCB-ADDR                 POINTER.

      *--------------------------------------------------------------
      *===> T A S K   C O N T R O L   B L O C K
      *--------------------------------------------------------------
       01  LK-TCB.
           10  FILLER                  PIC X(012).
           10  LK-TIOT-ADDR            POINTER.
           10  FILLER                  PIC X(028).
           10  LK-LAST-CDE-ADDR        POINTER.

      *--------------------------------------------------------------
      *===>     T A S K   I/O   T A B L E
      *--------------------------------------------------------------
       01  LK-TIOT.
           10  LK-JOB-NAME             PIC X(008).
           10  LK-JSTP-NAME            PIC X(008).
           10 LK-PSTP-NAME             PIC X(008).

      *--------------------------------------------------------------
      *===> C O N T E N T S    D I R E C T O R Y    E N T R Y
      *--------------------------------------------------------------
       01  LK-CDE.
           10  LK-PREV-CDE-ADDR        POINTER.
           10  FILLER                  PIC X(004).
           10  LK-PGM-NAME             PIC X(008).
           10  LK-EP-ADDR              PIC X(004).
           10  LK-EXTENT-LST-ADDR      POINTER.

      *--------------------------------------------------------------
      *===>         E X T E N T    L I S T
      *--------------------------------------------------------------
       01  LK-EXTENT-LST.
           10  FILLER                  PIC X(009).
           10  LK-PGM-LEN              PIC X(003).
           10  LK-LP-ADDR              PIC X(004).
           10  REDEFINES  LK-LP-ADDR.
           15  LK-LP-ADDR-BIN          PIC          9(009) COMP.
           10  REDEFINES  LK-LP-ADDR.
           15  LK-LP-ADDR-PTR          POINTER.

      ****************************************************************
       01  LK-COMPILER-INFO.
      ****************************************************************
           05  LK-VSCOB-INFO.
               10 FILLER               PIC X(020).
               10 LK-TYPE-VS           PIC X(002).
                  88 LK-VSCOBOL                     VALUE "VS".
               10 FILLER               PIC X(001).
               10 LK-VSREL-NBR         PIC X(001).
               10 FILLER               PIC X(112).
               10 LK-VSTIME            PIC X(008).
               10 LK-VSMO-DAY          PIC X(008).
               10 LK-VSYEAR            PIC X(004).
           05  REDEFINES  LK-VSCOB-INFO.
           10  LK-COBII-INFO.
               20 FILLER               PIC X(014).
               20 LK-TYPE-II           PIC X(002).
               20 FILLER               PIC X(001).
               20 LK-IIREL-NBR         PIC X(006).
               20 LK-IIMON-DAY-YR      PIC X(009).
               20 LK-IITIME            PIC X(008).
               20 FILLER               PIC X(004).
               20 LK-IIOPT-BYTES       PIC X(004).
1     /

      ****************************************************************
       PROCEDURE DIVISION.
      ****************************************************************

       000-MAINLINE.

      *--------------------------------------------------------------
      *===>  ESTABLISH ADDRESSABILITY FOR TIOT
      *--------------------------------------------------------------

           MOVE            X"0000021C" TO  WS-TCB-ADDR-01
           SET  ADDRESS OF LK-TCB-ADDR TO  WS-TCB-ADDR
           SET  ADDRESS OF LK-TCB      TO  LK-TCB-ADDR
           SET  ADDRESS OF LK-TIOT     TO  LK-TIOT-ADDR

      *--------------------------------------------------------------
      *===>  SET UP STEP NAMES FOR DISPLAY
      *--------------------------------------------------------------

           IF LK-JSTP-NAME = SPACES
              AND
              LK-PSTP-NAME = SPACES
              GO TO 000-CONTINUE
           END-IF
           IF LK-PSTP-NAME = SPACES
              MOVE LK-JSTP-NAME TO WS-JSTP-NAME
           ELSE
              MOVE LK-PSTP-NAME TO WS-JSTP-NAME
              MOVE LK-JSTP-NAME TO WS-PSTP-NAME
           END-IF
           .
       000-CONTINUE.

      *--------------------------------------------------------------
      *===>  SET UP PGM NAME FOR DISPLAY
      *--------------------------------------------------------------

           SET ADDRESS OF LK-CDE TO LK-LAST-CDE-ADDR
           PERFORM WITH TEST BEFORE UNTIL LK-PREV-CDE-ADDR = NULLS
                   SET ADDRESS OF LK-CDE TO  LK-PREV-CDE-ADDR
           END-PERFORM
           MOVE LK-PGM-NAME TO WS-PN-DISPLAY

      *--------------------------------------------------------------
      *===>  SET UP ENTRY POINT ADDR FOR DISPLAY
      *--------------------------------------------------------------

           MOVE LK-EP-ADDR   TO  WS-WORK-X5
           PERFORM 100-CONVERT-HEX-DATA
           MOVE WS-WORK-UNPACKED-8 TO WS-EP-DISPLAY

      *--------------------------------------------------------------
      *===>  SET UP LOAD POINT ADDR FOR DISPLAY
      *--------------------------------------------------------------
           SET ADDRESS OF LK-EXTENT-LST TO LK-EXTENT-LST-ADDR
           MOVE LK-LP-ADDR   TO  WS-WORK-X5
           PERFORM 100-CONVERT-HEX-DATA
           MOVE WS-WORK-UNPACKED-8 TO WS-LP-DISPLAY

      *--------------------------------------------------------------
      *===>  SET UP PGM LENGTH FOR DISPLAY
      *--------------------------------------------------------------
           MOVE    X"00"     TO  WS-WORK-X1
           MOVE LK-PGM-LEN   TO  WS-WORK-X3
           PERFORM 100-CONVERT-HEX-DATA
           MOVE    WS-WORK-UNPACKED-8  TO  WS-LEN-DISPLAY

      *--------------------------------------------------------------
      *===>  SET UP PGM END POINT ADDR FOR DISPLAY
      *--------------------------------------------------------------
           COMPUTE
           WS-WORK-FP  =  LK-LP-ADDR-BIN + (WS-WORK-BIN4 - 1)
           MOVE WS-WORK-FP   TO  WS-WORK-X5
           PERFORM 100-CONVERT-HEX-DATA
           MOVE WS-WORK-UNPACKED-8 TO WS-FP-DISPLAY

      *--------------------------------------------------------------
      *===>  SET UP COMPILER INFORMATION FOR DISPLAY
      *--------------------------------------------------------------
           SET ADDRESS OF LK-COMPILER-INFO TO LK-LP-ADDR-PTR
           IF  LK-TYPE-VS = "VS"
               MOVE   SPACES        TO WS-CTYPE-DISPLAY
               MOVE LK-VSREL-NBR    TO WS-CREL-DISPLAY
               MOVE LK-VSTIME       TO WS-CTIME-DISPLAY
               MOVE LK-VSMO-DAY     TO WS-VSMO-DAY-DISPLAY
               MOVE LK-VSYEAR       TO WS-VSYEAR-DISPLAY
           ELSE

      *    IF  LK-TYPE-II = "C2"
               MOVE    "II"         TO WS-CTYPE-DISPLAY
               MOVE LK-IIREL-NBR    TO WS-CREL-DISPLAY
               MOVE LK-IITIME       TO WS-CTIME-DISPLAY
               MOVE LK-IIMON-DAY-YR TO WS-CDATE-DISPLAY
           END-IF

           DISPLAY " "
      *--------------------------------------------------------------
      *===>  DISPLAY ALL INFORMATION PREVIOUSLY SET UP
      *--------------------------------------------------------------
           DISPLAY "*****************************"
                   "**************************************************"
           DISPLAY " PROGRAM "                     WS-PN-DISPLAY
                   " RUN FROM JOB "                LK-JOB-NAME
                   " IN STEP/PROCSTEP ===> "       WS-STEP-DISPLAY
           DISPLAY " COMPILED UNDER VSCOBOL"       WS-CTYPE-DISPLAY
                                          " REL  " WS-CREL-DISPLAY
                                          " AT "   WS-CTIME-DISPLAY
                                          " ON "   WS-CDATE-DISPLAY
      *--------------------------------------------------------------
      *===>  DISPLAY COBOL II OPTION BITS
      *--------------------------------------------------------------
           IF NOT     LK-VSCOBOL DISPLAY  " "
              MOVE    LK-IIOPT-BYTES      TO  WS-WORK-X5
              PERFORM 100-CONVERT-HEX-DATA
              MOVE    WS-WORK-UNPACKED-8  TO  WS-OPTBYTE-DISPLAY
              DISPLAY " INDICATORS FOR COMPILER OPTIONS IN EFFECT ==> "
                                                   WS-OPTBYTE-DISPLAY
           END-IF
           DISPLAY " "
           DISPLAY "                  " "ENTRY POINT "  WS-EP-DISPLAY
           DISPLAY "                  " " LOAD POINT "  WS-LP-DISPLAY
           DISPLAY "                  " "  END POINT "  WS-FP-DISPLAY
           DISPLAY "                  " "     LENGTH "  WS-LEN-DISPLAY
           DISPLAY "*****************************"
                   "**************************************************"
           DISPLAY " "
      ****************************************************************
      *             USED TO FORCE A DUMP AT EOJ
      *--------------------------------------------------------------
      *    COMPUTE WS-WORK-BIN4 =  WS-WORK-BIN4 / WS-ZERO
      ****************************************************************
           GOBACK
           .
       100-CONVERT-HEX-DATA.
      *--------------------------------------------------------------
      *===>  CONVERTS HEX DATA FOR DISPLAY PURPOSES
      *      E.G. X"04FB" ====> X"F0F4C6C2" OR 04FB CHARACTER
      *--------------------------------------------------------------
           MOVE    WS-WORK-PACKED TO WS-WORK-UNPACKED
           INSPECT WS-WORK-UNPACKED CONVERTING
                   X"FAFBFCFDFEFF"  TO  "ABCDEF"
           .
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 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 Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Speed-up/reduce CPU use of code prino PL/I & Assembler 0 Tue Sep 26, 2017 12:05 am

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