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

FILE STATUS Code check in Assembler


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Wed May 18, 2011 1:06 pm
Reply with quote

Hi,

I am writing some data into a file using PUT statement.
Code:

OPEN (OUTFLE,(OUTPUT))
LTR R15,R15
BNZ BADOPEN
DISMSG2 WTO 'OPEN OUTPUT FILE SUCCESS'
PUT OUTFLE,OUTREC
LTR R15,R15
BNZ BADPUT
DISMSG3 WTO 'WRITE OUTPUT FILE SUCCESS'

OUTFLE DCB DSORG=PS, +
MACRF=(PM), +
DDNAME=OUTFILE, +
LRECL=80, +
RECFM=FB, +
BLKSIZE=8000

The OPEN statement is success since the WTO message is displayed in SPOOL, But after the PUT statement, control is going to BADPUT Label.

Please tell me what is wrong with the PUT Statement?

JCL file declaration

//OUTFILE DD DSN=ISPF.V06530.TEST.FILE1,
// DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),
// UNIT=TEST,
// SPACE=(CYL,(10,20),RLSE)
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Wed May 18, 2011 1:18 pm
Reply with quote

Get and PUT dont return a return code in R15. In case of an error the DCB SYNAD routine wil get control if it exists.
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Wed May 18, 2011 1:37 pm
Reply with quote

Hi Vinay,

I think the program you are writing is a sample/test program. there's no harm in copy-pasting the whole program here.

While writing program code in your posts next time, please use the tag-button "Code". This will display your program code on black background with fixed sized fonts. The code section will thus be more readable.


About your query:
dont go on the content of R15.
(i)Check the content of your file after the job is executed.
(ii)make sure you close the file before exiting from program.
(iii)have a look at your jessysmsg and see if there is any ready-made system generated message. If one is there it will help you recognise the possible problem.
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Wed May 18, 2011 3:20 pm
Reply with quote

Hi Nihal/Peter,

Thanks for the information.

So the GET and PUT statements will not put the status code in R15?
The file is being created and also data is being written actually. So I shouldn't check for R15 for successfull execution of OPEN,GET or PUT statements? Please Confirm.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Wed May 18, 2011 3:27 pm
Reply with quote

The OPEN can be tested on R15, for the GET/PUT you have to supply a SYNAD routine if you want to handle errors yourself. If not supplied the OS will terminate your program abnormally.

You can find it all here :

DFSMS Macro Instructions for Data Sets
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Wed May 18, 2011 3:32 pm
Reply with quote

Thanks Peter.

One Question, Can't we handle specific I/O errors like we can do in COBOL using FILE-STATUS?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Wed May 18, 2011 3:37 pm
Reply with quote

vinayknj,

are you a little slow?
Quote:

for the GET/PUT you have to supply a SYNAD routine if you want to handle errors yourself
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Wed May 18, 2011 4:12 pm
Reply with quote

I got it that by coding a label for SYNAD in DCB we can handle I/O errors but can we identify wat error has occurred by looking at some status field like we do in COBOL using FILE-STATUS?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Wed May 18, 2011 4:29 pm
Reply with quote

Before you are asking things over and over read the fine manuals :

DFSMS Using Data Sets
DFSMS Macro Instructions for Data Sets

or stop using assembler.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed May 18, 2011 4:32 pm
Reply with quote

vinayknj:

1. Assembler is not COBOL.
2. COBOL is not Assembler
3. If you want file status codes, you need to use COBOL not Assembler
4. If you want to code in Assembler, learn to use the Assembler tools -- not wish for things from other languages.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu May 19, 2011 1:33 pm
Reply with quote

guess vinayknj did not want to look up SYNADAF in the manual
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Thu May 19, 2011 2:08 pm
Reply with quote

dbzTHEdinosauer wrote:
guess vinayknj did not want to look up SYNADAF in the manual


If the TS should have read any of the manuals i proposed (especially the part about the SYNAD exit) he should have stumbled over SYNADAF. But then the TS wants the answers to be repeated / explained over and over
again. I dont have the power anymore to do that again.
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 -> PL/I & Assembler

 


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