Scott, I have read the various replies and no-one (that I see) has pointed out that if you are using Enterprise COBOL 4.1, you are going about the task "the hard way". Enterprise COBOL (for several releases) has supported "dynamic allocation" of files that does NOT require you to do explicit calls to BPXWDYN.
Check out (for example), http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3LR50/4.2.3.1 and following. Or http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3pg50/1.8.3 and the pages that it points to. Once you switch to this technique, normal COBOL OPEN, CLOSE, etc statements do what you will want them to. -----Original Message----- I am trying to to the following in A LE Cobol 4.1 program, a Hi all: I am trying to to the following in A LE Cobol 4.1 program, a STC . I have specified a Select for the file .... SELECT FILEOUT ASSIGN TO FILEOUT ORGANIZATION IS SEQUENTIAL FILE STATUS IS FILEOUT-STATUS. I build the BPXWDYN call like this: *** Working Storage *** 01 DYNAM-CONSTANTS. 05 BPXWDYN-PGM PIC X(8) VALUE 'BPXWDYN'. 01 BPXWDYN-PARM. 10 BPXWDYN-PARM-LEN PIC S9(4) BINARY VALUE +100. 10 BPXWDYN-PARM-TXT PIC X(100). 01 DYNSYSOUT-TEMP. 10 FILLER PIC X(18) VALUE ' ALLOC DD(FILEOUT)'. 10 FILLER PIC X(8) VALUE ' SYSOUT('. 10 SYSOUTCL PIC X VALUE SPACE. 10 FILLER PIC X(10) VALUE ' MSG(WTP)'. 10 FILLER PIC X(32) VALUE ' FREE DD(FILEOUT) SPIN(UNALLOC)'. I fill in the SYSOUTCL variable via a parameter... I string the allocate like this: STRING DYNSYSOUT-TEMP DELIMITED BY SIZE INTO BPXWDYN-PARM-TXT END-STRING CALL BPXWDYN-PGM USING BPXWDYN-PARM-TXT The allocate works fine , no issue.. I write to the fileout no problem, works fine. I issue a free like this: STRING ' FREE DD(FILEOUT) ' DELIMITED BY SIZE INTO BPXWDYN-PARM-TXT CALL BPXWDYN-PGM USING BPXWDYN-PARM-TXT The rc says 0 it worked, But I look at the STC and the 'DD' is still allocated. Did the free not unallocate the 'DD'. I want a sysout dataset to be opened and closed multiple times via a command. Thanks all for any help Scott J Ford ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html

