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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PC File Names 1

Status
Not open for further replies.

amosgreg

Programmer
Oct 27, 1999
27
US
I am working on a PC project and am looking for some help on setting up a file name.<br>
Problem I want to be able to generate an output data set several times(different days) and have these named differently. I know on the Big Iron you can set up a JCL job stream and copy the output data set to the naming convention you are looking form, but is it possible to do so on the PC.<br>
Thanks Greg <br>

 
You can, in most PC based COBOL's, set up a dataname and assign the file to that dataname. This will allow you to programatically change the name every time you run, or based on something else keep the name the same from one run to the next.
 
I have tried this and I recieve eather a NULL file or else a file with the information in the Dataname as an unformated file. I know I'm missing a little piece of the puzzle. When I get the Null file error, it is after I try to open the file even after moving a value to the dataname. I am using as my file name and location. <br>
see below<br>
<br>
********************************************<br>
<br>
select RIDEREC <br>
ASSIGN TO REPORT-FILE-NAME1 <br>
* ASSIGN TO DISK REPORT-FILE-NAME1. <br>
organization is line sequential.<br>
<br>
* I have tried both file and DISK file and then added org <br>
* clause.<br>
<br>
in working storage<br>
<br>
01 report-header. <br>
03 REPORT-FILE-NAME1 PIC X(21) VALUE SPACES. <br>
03 REPORT-FILE-NAME2 PIC X(21) VALUE SPACES. <br>
<br>
and the first steps in MAIN<br>
<br>
0001-main. <br>
STRING "'C:\TEST\ride" <br>
FUNCTION CURRENT-DATE(5:4) <br>
FUNCTION CURRENT-DATE(9:4) <br>
".txt'" DELIMITED BY SIZE <br>
INTO REPORT-FILE-NAME1. <br>
<br>
<br>
open input RIDEREC <br>
<br>
<br>
************************************************<br>
Any help appreaciated<br>
Thanks Greg<br>
<br>
<br>
<br>

 
I have tried it on both IBM VisualAge Cobol and Microfocus Visual Object Cobol (predescessor to NetExpress)
 
Here is the way I have done it several times using NetExpress:<br>
<br>
SELECT IN-FILE ASSIGN TO INFILE-ID<br>
ORGANIZATION IS LINE SEQUENTIAL.<br>
.<br>
.<br>
*have also had organization sequential, indexed,<br>
and relative<br>
.<br>
.<br>
FD IN-FILE LABEL RECORDS ARE STANDARD.<br>
01 IN-REC PIC X(10).<br>
.<br>
.<br>
01 INFILE-ID PIC X(20) VALUE SPACES.<br>
.<br>
.<br>
PROCEDURE DIVISION.<br>
0001-MAIN.<br>
ACCEPT INFILE-ID.<br>
OPEN INPUT IN-FILE.<br>
.<br>
.<br>
* processing<br>
.<br>
.<br>
CLOSE IN-FILE.<br>
STOP RUN.
 
The Accept is what I haven't done. I have moved values to the field but the Accept might allow the values to be populated at run time. I'll try this!<br>
Thanks Greg
 
why are you opening the file &quot;input&quot; if you are trying<br>
to create it?<br>

 
Thanks mrregan, I finally got it to work. The input was part of the problem I also had a set of mismatched qoutes "' and ' that were causing problems. I knew it was something small.<br>
<br>
Thanks to all for your help.<br>
Greg
 
Have you used the following:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SELECT DAYMVM ASSIGN USING FILENAME1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ORGANIZATION IS LINE SEQUENTIAL.<br>.<br>.<br>.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WORKING-STORAGE SECTION.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*-----------------------<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;01 FILENAME1.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;05 filler pic x(04) value &quot;FILE&quot;.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;05 ws-nnnn pic 9(04).<br>&nbsp;&nbsp;&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sp;&nbsp;&nbsp;&nbsp;perform write-file.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;close daymvm.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;add 1 to nnnn.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;go to cycle1.<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top