Noticed two thing but not sure how important:

1. You are opening two file but only one is present in the program but should have produced an error!. 2. Moving spaces to 01 record and depending on your settings JCL wise it "might" be treated as blank / non-record and not write out.

Try it with say ALL 'A' or '1' and see what happens.

Vince


On 04/09/15 19:06, Rick Stetser wrote:
I haven't found a COBOL listserv so I'm posting this here.
I have Enterprise COBOL for z/OS 4.2.0.  I wrote a simple program to open a 
sequential output file, write a record to it, and then close the file.  The 
program compiles cleanly and when I run it I allocate the output dataset in the 
step the program runs in.  When the job completes the file is present but there 
aren't any records in it.

Here's my code:
SELECT DPGM-FILE              ASSIGN TO DMGPFILE
                      FILE STATUS IS DPGM-STATUS.


FD  DPGM-FILE
     BLOCK CONTAINS 0
     RECORDING MODE F
     LABEL RECORDS STANDARD.
01  DPGM-RECORD    PIC X(80).

OPEN OUTPUT DPGM-FILE, EPGM-FILE.
IF DPGM-STATUS EQUAL '00'
    NEXT SENTENCE
ELSE
    DISPLAY 'DPGM-STATUS=' DPGM-STATUS
    STOP RUN
END-IF.
MOVE SPACES TO DPGM-RECORD.
WRITE DPGM-RECORD.
  IF DPGM-STATUS EQUAL '00'
     NEXT SENTENCE
  ELSE
     DISPLAY 'DPGM-STATUS=' DPGM-STATUS
     STOP RUN
  END-IF.
  CLOSE DPGM-FILE.
GOBACK.

It's so simple I'm sure I'm missing something but I can't figure out what.  Any 
suggestions?

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
.



--
- IMPORTANT –

This email and the information in it may be confidential, legally privileged
and/or protected by law.
It is intended solely for the use of the person to whom it is addressed. If you
are not the intended recipient, please notify the sender immediately and do not
disclose the contents to any other person, use it for any purpose, or store or
copy the information in any medium.
Please also delete all copies of this email & any attachments from your system.

If this is an encrypted email it is your responsibility to maintain the
1024 byte key system even for one-use keys. Once mail has been sent the sending
key is not kept and therefore a replacement mail cannot be resent.

We cannot guarantee the security or confidentiality of non encrypted email
communications. We do not accept any liability for losses or damages that you
may suffer as a result of your receipt of this email including but not limited
to computer service or system failure, access delays or interruption, data
non-delivery or mis-delivery, computer viruses or other harmful components.

Copyright in this email and any attachments belongs to Applewood Computers.
Should you communicate with anyone at Applewood Computers by email, you consent
to us monitoring and reading any such correspondence.

Nothing in this email shall be taken or read as suggesting, proposing or
relating to any agreement concerted practice or other practice that could
infringe UK or EC competition legislation (unless it is against Security
requirements).

This Email and its attachments (if any) are scanned for virii using Clamd and
ClamAV 0.98.8 or later (Linux x64).

Dykegrove Limited T/A Applewood Computers is a company registered in England
(no. 01681349) whose registered office is at Applewood House, Epping Road,
Roydon, Essex, CM19 5DA

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to