FWIW, on z/OS 1.12, using COBOL 3.4.1, your program compiles and runs just fine.
OK, I do things strangely. What I really did was use "vi" to create your program (cut from the email) in a UNIX shell. I then edited it in ISPF to put in all the extra junk the compiler wants. I did a "cob2 -o test2 test2.cbl"command in my UNIX shell to compile the program. Lastly, I set the UNIX environment variable DMGPFILE to point to a UNIX file and ran the program. Yes, I ran it in UNIX. But I ended up with a file containing 80 blanks. Just what I expected. On Fri, Sep 4, 2015 at 1:06 PM, Rick Stetser < [email protected]> 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 [email protected] with the message: INFO IBM-MAIN > -- Schrodinger's backup: The condition of any backup is unknown until a restore is attempted. Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be. He's about as useful as a wax frying pan. 10 to the 12th power microphones = 1 Megaphone Maranatha! <>< John McKown ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
