View previous topic :: View next topic
|
Author |
Message |
Ravi Kuchi
New User
Joined: 29 May 2012 Posts: 14 Location: INDIA
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Ravi Kuchi
New User
Joined: 29 May 2012 Posts: 14 Location: INDIA
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Ravi Kuchi
New User
Joined: 29 May 2012 Posts: 14 Location: INDIA
|
|
|
|
Hi Bill,
I have tried both the above but were not successful.
Thanks
Ravi Kuchi |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Ravi Kuchi
New User
Joined: 29 May 2012 Posts: 14 Location: INDIA
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Define an abend exit in the DCB via the EXLST parameter.
Info can be found here : DFSMS Using Data Sets |
|
Back to top |
|
|
Ravi Kuchi
New User
Joined: 29 May 2012 Posts: 14 Location: INDIA
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
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 |
|
|
Ravi Kuchi
New User
Joined: 29 May 2012 Posts: 14 Location: INDIA
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Ravi Kuchi
New User
Joined: 29 May 2012 Posts: 14 Location: INDIA
|
|
|
|
it is fixed.. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
All the time i see something like a "MEMBER" variable. Are you reading a PDS? |
|
Back to top |
|
|
Grant Goodale
New User
Joined: 13 Nov 2010 Posts: 67 Location: Brampton, Ontario, Canada
|
|
|
|
The EXLST= parameter specifies the address of an exit list, not an exit routine. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Your EXLIST should look like this :
Code: |
INPUT DCB DDNAME=INPUT,DSORG=PS,MACRF=GL,
RECFM=FB,EXLST=EXITLIST
EXITLIST DS 0A
DC X'91',AL3(FERROR)
|
You really should read DFSMS Using Data Sets (chapter 31). |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
PeterHolland wrote: |
All the time i see something like a "MEMBER" variable. Are you reading a PDS? |
B.t.w. you didnt answer this. |
|
Back to top |
|
|
Ravi Kuchi
New User
Joined: 29 May 2012 Posts: 14 Location: INDIA
|
|
|
|
Hi Peter,
Thanks a lot !
The EXLST seems to be working, now I am into the FERROR para when I encounter the corrupt file. Just was wondering how I can set the return code to zero and exit gracefully.
No, I am not reading a PDS here, sorry the variable would have got carried as it is a work in progress module.
Thanks again! |
|
Back to top |
|
|
|