Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing to disk versus writing to SYSOUT 2

Status
Not open for further replies.

dbadc

Programmer
Apr 13, 2010
9
0
0
US
I have a mainframe COBOL program that writes a report file to disk. When I try looking at the disk after the program completes successfully, the disk is empty.

If I run the exact same program and put the report out to SYSOUT, I can see the output that is written out.

What can be causing it not to write out to disk?
 
Look for multiple OPEN OUTPUT statements. If you reopen a SYSOUT file, JES simply creates another output stream. If you reopen a disk file, the existing disk file is reset to zero.
 
What can be causing it not to write out to disk?
The data was most likely written - then destroyed.

Check the code for multiple OPEN OUTPUT statememts/executions.
or
Change the DISP to MOD rather than NEW as an experiment.
 
Thanks webrabbit and papadba. I really appreciate your quick responses. You are both right.

When I change the disp to MOD, I see the output.
I put in some displays to the program and found that the OPEN was executed more than once as you both correctly ascertained.

The program does have an open-switch set to 0 in working storage that gets set to 1 on the first pass and then has an instruction to open the output, but although there is no code that sets the open-switch back to 0, it is 0 on the second go-around.

Is it possible that a fresh copy of the program is getting loaded on the second time around that is re-initializing the switch in working storage.

Are there any special compile or link-edit options that need to be invoked to stop this from happening?
 
If the program is compiled/linked with the INIT or INITIAL option, this behavior wil result. Remove that option, if it is in use. The option may have a different name. Also, the program may have IS INITIAL clause in the PROGRAM-ID paragraph.
 
Thanks webrabbit.

I can not find any options for the compiler or link-editor that resemble or look like INIT or INITIAL. Is it possible for you to come up with the exact name?

Thanks again!
 
If I recall correctly, INIT goes on the
PROGRAM-ID. prog-name INITIAL.

I think it only applies to sub-programs. It indicates that each time the program is called, it will be rest to its initial state which resets all VALUE clauses.
 
Are you saying that it can not be invoked through a compile or link-edit option?
 
I understand that you can use the Program-ID clause to include IS INITIAL, my question is referring back to webrabbit's post about "If the program is compiled/linked with the INIT or INITIAL option, this behavior wil result. Remove that option, if it is in use. The option may have a different name." I can't find that option and was wondering if it does go by a different name, - what is that name?
 
I'm sorry. It's been too many years since I worked on a mainframe, and I have forgotten many details, and much has changed.
 
Thanks webrabbit.
I appreciate your help! If anyone else out there knows about a compiler or link option like "INIT" or "INITIAL" as described earlier:

"If the program is compiled/linked with the INIT or INITIAL option, this behavior wil result. Remove that option, if it is in use. The option may have a different name."[
please post a response.

Thanks to all, your help is much appreciated.
 
The link i posted earlier is for the currently most-used compiler on the IBM Mainframe. The option is INITIAL.

Why is a different name being looked for if this question is about an IBM Mainframe?

Why is additional effort required? The earlier replies appear to provide the means to fix the problem - change the jcl or change the code. . .

Maybe there is still something i misunderstand?
 
papadba,

I know that there is the "is INITIAL" option in the PROGRAM-ID clause. My program does not have it nor do I want it.

I want to avoid the problem of reinitialization so that the open-switch that is set to "1" after an open is not set back to the original "0" it is set to in working storage.

Webrabbit mentioned a possible compile or link option of INIT or INITIAL that I want to make sure was not used in the compile and link of this old program I am working with. And if it was I would recompile and link with the opposite option.
 
You never said if this is a subprogram. The INITIAL clause only applies to a subprogram. If you're dealing with a main program, there is some sort of logic error that is causing your switch to be reset.
 
It is a user-exit program to a vendor supplied utility that reads an ADABAS Log file.
 
Can't you do a little debugging to see how your switch is being reset if in fact it is. Seems to me when you reenter the program, if the open switch is off you'll try to open the file again. Should get an error unless you closed it when you left the time before.

Why not display the value of the switch upon entry and exit to verify if it is getting reset or not.

An alternative to the INITIAL clause is to have the calling program execute a CANCEL statement which removes the subprogram from memory so it gets reloaded upon the next call which resets everything back to its original values. Could your vendor program be doing such a thing?
 
Thanks for your ideas. I got around the problem by using an earlier suggestion by webrabbit and papadba of defining the output dataset as MOD. That way the first time it writes to the dataset it sees it as NEW and on subsequent writes it MODs the dataset rather than overwriting and blanking it out as it was doing previously.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top