Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Error Handling with OPEN MACRO
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
Ravi Kuchi

New User


Joined: 29 May 2012
Posts: 14
Location: INDIA

PostPosted: Tue May 29, 2012 5:04 pm    Post subject: Error Handling with OPEN MACRO
Reply with quote

Hi,

I am trying to open a file with "INVALID BLOCK SIZE". But the program abends as soon as it finishes OPEN MACRO instruction. Is there a way we can capture the return code and do error handling so that we can display some messages and exit gracefully.

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

Bill O'Boyle

CICS Moderator


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

PostPosted: Tue May 29, 2012 6:13 pm    Post subject: Reply to: Error Handling with OPEN MACRO
Reply with quote

First, you can test R15 (which will contain the Return-Code) for zero or non-zero. The popular method is via a Load And Test Register (LTR R15,R15) with BZ or a BNZ CC.

Another method uses the DCBD Macro -
Code:

          DCBD
          OPEN   "FILENAME"
          LA      R1,"FILENAME"
          USING   IHADCB,R1
          TM      DCBOFLGS,X'10'
          BZ      BADOPEN
Back to top
View user's profile Send private message
Ravi Kuchi

New User


Joined: 29 May 2012
Posts: 14
Location: INDIA

PostPosted: Tue May 29, 2012 6:24 pm    Post subject: Reply to: Error Handling with OPEN MACRO
Reply with quote

Thanks for responding Bill,

For this kind of error "INVALID BLOCK SIZE FILE" the OPEN Macro does not return so the next instruction "LA R1,"FILENAME"" onwards would never get executed.

I am thinking if there is a way to modify the OPEN macro itself to hanle this kind of error
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Tue May 29, 2012 6:49 pm    Post subject: Reply to: Error Handling with OPEN MACRO
Reply with quote

Try inserting the LTR R15,R15 right after the OPEN Macro and before the LA of R1. R15 should contain a value to interrogate. I'm assuming this is a variable-length QSAM file and not VSAM?
Back to top
View user's profile Send private message
Ravi Kuchi

New User


Joined: 29 May 2012
Posts: 14
Location: INDIA

PostPosted: Tue May 29, 2012 6:52 pm    Post subject:
Reply with quote

Hi Bill,

I have tried both the above but were not successful.

Thanks
Ravi Kuchi
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Tue May 29, 2012 7:10 pm    Post subject: Reply to: Error Handling with OPEN MACRO
Reply with quote

The maximum LRECL = (LRECL + 4) and the BLKSIZE should not be greater than 32768 and be a multiple of ((32768 / (LRECL + 4) + 4) without a remainder as an optimum value. I have seen 32768 subsituted with the maximum value of one-half track associated with the DASD device/model, which lends itself to a more optimum BLKSIZE.

Are these similar to the calculations you're using?

This is a QSAM file, correct?

Review the SYNAD optional keyword of the DCB Macro. If there's an error, MVS issues an internal BAL/BAS to the label/routine specified for the SYNAD, performs your error processing and returns control to the NSI after the OPEN.
Back to top
View user's profile Send private message
Ravi Kuchi

New User


Joined: 29 May 2012
Posts: 14
Location: INDIA

PostPosted: Tue May 29, 2012 8:56 pm    Post subject: Reply to: Error Handling with OPEN MACRO
Reply with quote

Hi Bil,

Not much of luck with SYNAD, not sure if I used it in the right way, here is the code in the attachment. Please see if u can find the issue:

By the way the file is just a flat file
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue May 29, 2012 9:25 pm    Post subject: Reply to: Error Handling with OPEN MACRO
Reply with quote

DO NOT POST ATTACHMENTS, NOT EVERYBODY CAN SEE THEM
REDUCING THGE NUMBER OF PEOPLE WHO CAN HELP

USE A PLAIN TEXT CUT AND PASTE WITH THE CODE TAGS.

the attachment has been deleted!

Quote:
By the way the file is just a flat file


whatever the format .... the attachment You posted is unreadable.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Tue May 29, 2012 10:38 pm    Post subject: Reply to: Error Handling with OPEN MACRO
Reply with quote

My error. The SYNAD label/exit is used to capture errors in actual I-O (GET, PUT, DELETE, etc).

I don't know where else to point you to.

Are you Assembling/Linking with RMODE 24?

In other words, the program is not using an extended DCB?
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue May 29, 2012 11:59 pm    Post subject:
Reply with quote

Hello,

Typically, what is done to resolve the error is to determine the cause of the open error and correct the code, the jcl, or re-create the input file.

Once the open error is resolved, there should be no need to "handle" an open error.

Possibly, there is something i am missing.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Wed May 30, 2012 12:20 am    Post subject: Reply to: Error Handling with OPEN MACRO
Reply with quote

In your JCL/DCB, does the LRECL and BLKSIZE match what's coded in the program's DCB LRECL and BLKSIZE or vice versa?

Just a SWAG....
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed May 30, 2012 12:31 am    Post subject:
Reply with quote

just a thought.

in cobol, when you use the file-status clause,
any i/o error can be trapped by the code,
and you can 'gracefully' exit the step,
instead of what is probably happening to the TS
which is he is getting about 400,000 lines of dump
because he can't get his jcl and code in sync,
and someone said 'hey, WTF is wrong with your program?'
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed May 30, 2012 2:49 am    Post subject:
Reply with quote

Hello,

Maybe it is time to ask which specific abend are you dealing with?

Please post the error message and id along with the jcl being submitted and the file attributes for the problem file. Posting the DCB from the code may help also.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Wed May 30, 2012 3:09 am    Post subject: Reply to: Error Handling with OPEN MACRO
Reply with quote

If you know that the file you are trying to open has an invalid blocksize, why are you trying to open it? And why do you want to report and exit gracefully?

The combinations and possibilities for errors you get on an open are already dealt with by system messages. There are quite a number and variety of them.

Why do you want to do what you are trying (or trying to get us) to do?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Wed May 30, 2012 11:55 am    Post subject:
Reply with quote

Define an abend exit in the DCB via the EXLST parameter.
Info can be found here : DFSMS Using Data Sets
Back to top
View user's profile Send private message
Ravi Kuchi

New User


Joined: 29 May 2012
Posts: 14
Location: INDIA

PostPosted: Wed May 30, 2012 4:37 pm    Post subject: Reply to: Error Handling with OPEN MACRO
Reply with quote

I think ACB and EXLST work for VSAM dataset only, but the file I would be testing is a flat file.

The problem or issue is as follows:
Before opening the file we do not know if the file is valid or invalid, so incase the file is invalid(block size) I would like to trap the error and perform some record keeping stuff and end the job

Below is the code, I am trying to work on:

Code:
* LAST SAVED BY SNS ON 01/26/99 AT 11:11:05                             
* LAST ASSEMBLY DATE - 01/26/99 - TIME 11:10:16                         
*PREPASM=OFF                                                           
         GBLC  &DATEMAC,&TIME                                           
         LCLC  &CSECT,&LIBR,&REL,&VER,&MOD,&PGMR,&DATE                 
         COPY  PWRGGBL                                                 
&DATEMAC SETC  '05/29/12'                                               
&TIME    SETC  '05:24:05'                                               
&CSECT   SETC  'PXXXPDSD'                                               
&LIBR    SETC  'DTCNOSGP'                                               
&REL     SETC  'NOSGP'                                                 
&VER     SETC  '01'                                                     
&MOD     SETC  '00'                                                     
&PGMR    SETC  'SNS'                                                   
&DATE    SETC  '05/29/12'                                               
         TITLE '                                         (LIB=&LIBR RELX
               =&REL V.M=&VER..&MOD PGMR=&PGMR DATE=&DATE)'             
*                                                                       
* MODIFICATIONS                                                         
         SPACE                                                         
*                                                                       
         PUNCH ' PHASE PXXXPDSD,*'                                     
         PUNCH ' SETOPT PARM(REUS=SERIAL)'                             
         PUNCH ' INCLUDE ,(&CSECT)'                                     
&CSECT   AMODE ANY                                                     
&CSECT   RMODE 24                                                       
&CSECT   BGNSECT                                                       X
               DSPLY=YES,                                              X
               BASE=(8,9),                                             X
               DATE=&DATE,                                             X
               V=&VER,                                                 X
               M=&MOD                                                   
         L     R10,0(0,R1)                                             
         USING PARM,R10                                                 
         MESG  'BEFORE INPUT RAVI'                                     
         OPEN  (INPUT,(INPUT))                                         
         MESG  'AFTER INPUT RAVI'                                       
*        LTR   R15,R15                                                 
         GET   INPUT                                                 
         OI    RC+1,X'04'                                             
*        ST    R15,PRETC                                             
*        B     EXITMOD                                               
ABCEOF   EQU   *                                                     
         CLOSE (INPUT,REWIND)                                         
         LH    R15,RC                                                 
         L     13,SAVE+4                                             
         RETURN (14,12),T,RC=(15)                                     
*        BZ    DOSTOW                                                 
*DOSTOW   MVC   MEMBER,PMEMBER                                       
*        STOW  PDS,MEMBER,D                                           
*        ST    R15,PRETC                                             
*        CLOSE PDS                                                   
EXITMOD  EMOD                                                         
         EJECT                                                       
**********************************************************************
*                                                                    *
*                 STORAGE AND CONSTANT AREAS DEFINED BELOW           *
*                                                                   *   
********************************************************************** 
*        EJECT                                                         
*        EJECT                                                         
         ENDSECT                                                       
MEMBER   DS    CL8                                                     
INPUT    DCB   DDNAME=INPUT,DSORG=PS,MACRF=GL,                         X
               RECFM=FB                                                 
********************************************************************** 
*                                                                    * 
*                 REGISTER EQUATES                                   * 
*                                                                    * 
********************************************************************** 
         REQU                                                           
         DCBD  DSORG=PS                                                 
PARM     DSECT                                                         
PDDNAME  DS    CL8                                                     
PRETC    DS    F                                                       
RC       DC    H'0'                                                     
SAVE     DS    18F     
PMEMBER  DS    CL8     
         EJECT         
         END   &CSECT
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Wed May 30, 2012 5:08 pm    Post subject:
Reply with quote

PeterHolland wrote:
Define an abend exit in the DCB via the EXLST parameter.
Info can be found here : DFSMS Using Data Sets


Did yo read my post carefully? Did I mention ACB? You want really any help?
Back to top
View user's profile Send private message
Ravi Kuchi

New User


Joined: 29 May 2012
Posts: 14
Location: INDIA

PostPosted: Wed May 30, 2012 6:06 pm    Post subject:
Reply with quote

Hi Peter,

Sorry for the misunderstanding, I am a beginner in assembler so please excuse.

Here is the piece of code I am trying to execute:

Code:
        MESG  'BEFORE INPUT RAVI'                                     
         OPEN  (INPUT,(INPUT))                                         
         MESG  'AFTER INPUT RAVI'                                       
         RETURN                                                         
FERROR   EQU   *                                                       
         MESG  'HANLDE ABEND HERE'                                     
         RETURN                                                         
         EJECT                                                         
EXITMOD  EMOD                                                           
         EJECT                                                         
         ENDSECT                                                       
MEMBER   DS    CL8                                                     
MSGAREA  DS    0CL68                                                   
         DC    CL46' '                                                 
INPUT    DCB   DDNAME=INPUT,DSORG=PS,MACRF=GL,
               RECFM=FB,EXLST=FERROR             


I am expecting that when an open error occurs, it should go to FERROR routine and display the message but it won't reach there.
For your info the error I get for the invalid block size file is:

IEC141I 013-20,IGG0191A,RSURESHT,STEP0010,INPUT,D827,TMP391,QYET.MDEAFT3.APL1.PT
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Wed May 30, 2012 6:23 pm    Post subject: Reply to: Error Handling with OPEN MACRO
Reply with quote

I've been under the impression this is a variable-length file. But, your DCB RECFM specifies FB?

Is it fixed or variable?
Back to top
View user's profile Send private message
Ravi Kuchi

New User


Joined: 29 May 2012
Posts: 14
Location: INDIA

PostPosted: Wed May 30, 2012 7:00 pm    Post subject:
Reply with quote

it is fixed..
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 -> PL/I & Assembler All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm
No new posts Error IEC161I 052(009,XXXRS00)-084 wh... amitc23 JCL & VSAM 10 Wed Oct 12, 2016 5:00 pm
No new posts IDMS/DC-COBOL program - SNAP error wh... rakeshsekar1987 IDMS/ADSO 5 Tue Sep 13, 2016 8:28 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us