Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 8500

COBOL Programming :: RE: Dynamic output file creation in cobol using BPXWDYN

$
0
0
Author: Robert Sample
Subject: Reply to: Dynamic output file creation in cobol using BPXWDYN
Posted: Thu Jun 15, 2017 11:47 pm (GMT 5.5)

How do you know BPXWDYN worked correctly? Try
Code:
DISPLAY RETURN-CODE
after the call to BPXWDYN. If it is not zero, then the call did NOT work and (most likely) your allocated data set wasn't allocated. And since you didn't bother with file status (which should be a mortal sin for professional COBOL programmers such as those posting on this web site), you have no idea if the OPEN worked or not, if the WRITE worked or not, and if the CLOSE worked or not.

In other words, by your lack of error checking you have no way of knowing whether ANYTHING you did worked. If you decide to post anything else, we'll want to see RETURN-CODE after the call to BPXWDYN as well as the file status code for the OPEN, WRITE, and CLOSE statements. And if any of the four values are not zero, then you CANNOT tell us you have a "successful job run".

And, by the way, either the code you posted has a typo (BPXDWYN is what you are calling whereas BPXWDYN is the name of the IBM module) or the explanation for your results is calling the wrong program and NOT doing any error checking.
_________________
TANSTAAFL

The first rule of code reuse is that the code needs to be worth re-using.

"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." -- Donald Knuth


Viewing all articles
Browse latest Browse all 8500

Trending Articles