×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Writing to disk versus writing to SYSOUT
2

Writing to disk versus writing to SYSOUT

Writing to disk versus writing to SYSOUT

(OP)
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?

RE: Writing to disk versus writing to SYSOUT

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.

RE: Writing to disk versus writing to SYSOUT

Quote:

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.

RE: Writing to disk versus writing to SYSOUT

(OP)
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?  

RE: Writing to disk versus writing to SYSOUT

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.

RE: Writing to disk versus writing to SYSOUT

(OP)
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!

RE: Writing to disk versus writing to SYSOUT

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.    

RE: Writing to disk versus writing to SYSOUT

(OP)
Are you saying that it can not be invoked through a compile or link-edit option?

RE: Writing to disk versus writing to SYSOUT

(OP)
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?  

RE: Writing to disk versus writing to SYSOUT

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.   

RE: Writing to disk versus writing to SYSOUT

(OP)
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.

RE: Writing to disk versus writing to SYSOUT

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?

RE: Writing to disk versus writing to SYSOUT

(OP)
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.

RE: Writing to disk versus writing to SYSOUT

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.  

RE: Writing to disk versus writing to SYSOUT

(OP)
It is a user-exit program to a vendor supplied utility that reads an ADABAS Log file.

RE: Writing to disk versus writing to SYSOUT

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?  

RE: Writing to disk versus writing to SYSOUT

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close