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!

FILE DEFINITION

Status
Not open for further replies.

fabiousa

MIS
Aug 13, 2001
45
BR
Hello guys,

I need to write a very stupid code to read and write a file. WHERE do I specify the directories where those files are located?
I tried to run the program and it seems I get a "35" error code when I open the files. I am guessing it's because I defined their location in the wrong place. Is there a easy way to do it?
Also don't laugh at my code, it's the first one hahaha

BB IDENTIFICATION DIVISION.
BB ENVIRONMENT DIVISION.
BB CONFIGURATION SECTION.
BB *SOURCE-COMPUTER. IBM-370 WITH DEBUGGING MODE.
BB INPUT-OUTPUT SECTION.
BB FILE-CONTROL.
BB *
BC SELECT EXTIN ASSIGN TO EXTERNAL ENTRADA
BC FILE STATUS IS EXTIN-STATUS.
BC *
BC SELECT EXTOUT ASSIGN TO EXTERNAL SAIDA
BC ORGANIZATION IS LINE SEQUENTIAL
BC FILE STATUS IS EXTOUT-STATUS.

BB DATA DIVISION.
BB FILE SECTION.
BB *
FD EXTIN
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS STANDARD
FFS RECORD CONTAINS 667 CHARACTERS.
FFS 01 ENTRADA-REC PIC X(667).
*
FD EXTOUT
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS STANDARD
FFS RECORD CONTAINS 667 CHARACTERS.
FFS 01 SAIDA-REC PIC X(667).
CC *
BB WORKING-STORAGE SECTION.
BB 01 W-FILE-STATUS-CODES VALUE ZERO.
BB 03 EXTIN-STATUS PIC XX.
BB 03 EXTOUT-STATUS PIC XX.

BB PROCEDURE DIVISION.
BB *
BB OPEN INPUT EXTIN.
BB OPEN OUTPUT EXTOUT

IF EXTIN-STATUS NOT = '00'
DISPLAY EXTIN-STATUS
GOBACK.

IF EXTOUT-STATUS NOT = '00'
DISPLAY EXTOUT-STATUS
GOBACK.

BB *
BB LER.
BB READ EXTIN INTO ENTRADA-REC AT END
BB CLOSE EXTIN EXTOUT
GO TO FIM.
BB MOVE ENTRADA-REC TO SAIDA-REC
WRITE SAIDA-REC.
BB GO TO LER.
FIM.
GOBACK.
 
is this mainframe, if so you would normally specify the files you need in the library/dataset declarations of the JCL you are using to run the prog.
 
I appologize...Usually for mainframes you assign file names to DDNAMES which point to DSNAMES.
This is in WINDOWS....where are the DDNAMES and DSNAMES in WINDOWS?????
 
Hi,

in windows if you use for example CA-REALIA, you can use symbolic filenames (like dd-names) by setting them in the environment.

So for example from the prompt you say:

SET ENTRADA="C:\MYFILE"

or something like that.

An other way is to work with an assign to varying file-name-entrada, where a field in your working-storage with this name contains the value "C:\MYFILE".

Your compiler is delivered with some examples. Look at them and you will probably find something good.

If nothing helps, look inside the manuals... :)

Regards,

Crox
 
Hi,
U have to specify the file name in the

in two steps:

1. In environment division :
select <filename> assign to disk.

2. Then in the file section:

u mention the file id stmt.

try this or i will send u the complete running code
byeee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top