file-control
Moderators: dbzTHEdinosauer, Moderator Group
file-control
in file-control section.
select file-ref assign to file
can i give a sequential file name?
if i have file on my disk, how to specify the path ?
i gave 'C:\filename.txt'
but it takes as 'C00filename' by throwing below error
There was an unsuccessful OPEN or CLOSE of file C00filename in program FILEINP at relative location X'04C8'.
Neither FILE STATUS nor an ERROR declarative were specified. The status code was 35.
From compile unit FILEINP at entry point FILEINP at compile unit offset +000004C8 at entry offset +000004C8 at
address 11700C30.
select file-ref assign to file
can i give a sequential file name?
if i have file on my disk, how to specify the path ?
i gave 'C:\filename.txt'
but it takes as 'C00filename' by throwing below error
There was an unsuccessful OPEN or CLOSE of file C00filename in program FILEINP at relative location X'04C8'.
Neither FILE STATUS nor an ERROR declarative were specified. The status code was 35.
From compile unit FILEINP at entry point FILEINP at compile unit offset +000004C8 at entry offset +000004C8 at
address 11700C30.
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
allen,
I can only point to the reference manual where it discusses environmental variables
am a little confused with:
if jcl, refer to the JCL manual.
I can only point to the reference manual where it discusses environmental variables
am a little confused with:
in the cobol program or your jcl?i gave 'C:\filename.txt'
if jcl, refer to the JCL manual.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
Even if i give a sequential file as input file, it doesnt work.
COBOL Program:
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLE1.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INFILE ASSIGN TO IN1.
SELECT OUTFILE ASSIGN TO OUT1.
DATA DIVISION.
FILE SECTION.
FD INFILE
RECORDING MODE F.
01 INREC.
05 INVAL PIC 9(3).
FD OUTFILE
RECORDING MODE F.
01 OUTREC.
05 OUTVAL PIC 9(3).
WORKING-STORAGE SECTION.
01 ARE-THERE-MORE-RECORDS PIC XXX VALUE 'YES'.
PROCEDURE DIVISION.
100-MAIN-MODULE.
OPEN INPUT INFILE.
OPEN OUTPUT OUTFILE.
PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO'
READ INFILE
AT END
MOVE 'NO' TO ARE-THERE-MORE-RECORDS
NOT AT END
PERFORM 200-CALC
END-READ
END-PERFORM.
CLOSE INFILE.
CLOSE OUTFILE.
STOP RUN.
200-CALC.
MOVE INVAL TO OUTVAL
WRITE OUTREC.
in JCL program i have given : (i have just copied part of jcl)
//T388062S JOB (12345678),SAMPLE1,MSGCLASS=A,
// MSGLEVEL=(1,1),CLASS=A,NOTIFY=T388062,RESTART=*
//COBOL EXEC PGM=IGYCRCTL,REGION=640K,COND=(12,LE),
// PARM=(NOTERM,NOSEQUENCE,LIB,XREF,DYN,'')
//SYSPRINT DD SYSOUT=(*)
//SYSIN DD DSN=T388062.AB.S(SAMPLE1),DISP=SHR
//IN1 DD DSN=T388062.EMPDET,DISP=SHR
//OUT1 DD DSN=T388062.EMPOUT,DISP=SHR
//SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(2,2))
-
-
-
program is abended with error :
There was an unsuccessful OPEN or CLOSE of file IN1 in program SAMPLE1
at relative location X'04C6'. Neither FILE STATUS nor an ERROR declarative were specified. The status status code was 35. From compile unit SAMPLE1 at entry point SAMPLE1 at compile unit offset +000004C6 at entry offset +000004C6 at address 11700C16.
I have an input dataset named EMPDET(FB,Sequential file, LRECL=3) and empty output dataset (same as input file)
COBOL Program:
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLE1.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INFILE ASSIGN TO IN1.
SELECT OUTFILE ASSIGN TO OUT1.
DATA DIVISION.
FILE SECTION.
FD INFILE
RECORDING MODE F.
01 INREC.
05 INVAL PIC 9(3).
FD OUTFILE
RECORDING MODE F.
01 OUTREC.
05 OUTVAL PIC 9(3).
WORKING-STORAGE SECTION.
01 ARE-THERE-MORE-RECORDS PIC XXX VALUE 'YES'.
PROCEDURE DIVISION.
100-MAIN-MODULE.
OPEN INPUT INFILE.
OPEN OUTPUT OUTFILE.
PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO'
READ INFILE
AT END
MOVE 'NO' TO ARE-THERE-MORE-RECORDS
NOT AT END
PERFORM 200-CALC
END-READ
END-PERFORM.
CLOSE INFILE.
CLOSE OUTFILE.
STOP RUN.
200-CALC.
MOVE INVAL TO OUTVAL
WRITE OUTREC.
in JCL program i have given : (i have just copied part of jcl)
//T388062S JOB (12345678),SAMPLE1,MSGCLASS=A,
// MSGLEVEL=(1,1),CLASS=A,NOTIFY=T388062,RESTART=*
//COBOL EXEC PGM=IGYCRCTL,REGION=640K,COND=(12,LE),
// PARM=(NOTERM,NOSEQUENCE,LIB,XREF,DYN,'')
//SYSPRINT DD SYSOUT=(*)
//SYSIN DD DSN=T388062.AB.S(SAMPLE1),DISP=SHR
//IN1 DD DSN=T388062.EMPDET,DISP=SHR
//OUT1 DD DSN=T388062.EMPOUT,DISP=SHR
//SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(2,2))
-
-
-
program is abended with error :
There was an unsuccessful OPEN or CLOSE of file IN1 in program SAMPLE1
at relative location X'04C6'. Neither FILE STATUS nor an ERROR declarative were specified. The status status code was 35. From compile unit SAMPLE1 at entry point SAMPLE1 at compile unit offset +000004C6 at entry offset +000004C6 at address 11700C16.
I have an input dataset named EMPDET(FB,Sequential file, LRECL=3) and empty output dataset (same as input file)
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
http://www.mainframegurukul.com/ibmmain ... php?t=5956
And how does this help us to help you:
And how does this help us to help you:
, specially after seeing your COBOL Code, JCL and error?I have an input dataset named EMPDET(FB,Sequential file, LRECL=3) and empty output dataset (same as input file)
Regards,
Anuj
Anuj
file-control
i meant to say that i have created both input and output files, just i want to move records to output file.
but i got to know what is my mistake, i have to give file reference,
while linking, i had given this in compilation.
now its working fine. thank you.
but i got to know what is my mistake, i have to give file reference,
//IN1 DD DSN=T388062.EMPDET,DISP=SHR
//OUT1 DD DSN=T388062.EMPOUT,DISP=SHR
while linking, i had given this in compilation.
now its working fine. thank you.
file-control
oh ok. thanks for the information.
DikDude wrote:Why? This is not valid mainframe syntax. Are you actually running on a mainframe?i gave 'C:\filename.txt'
How will the program be executed? Post the execution JCL.
The cobol program on the mainframe cannot automagically grab a file from "your disk".
then how can i specify a disk file in cobol program?
i have seen in some books they have given disk file as input/output.
my jcl code doesnt specify anything about disk file. it just takes the cobol program. thats it.
//T388061G JOB (12345678),SORTCOB1,MSGCLASS=A,
// MSGLEVEL=(1,1),CLASS=A,NOTIFY=T388062,RESTART=*
//COBOL EXEC PGM=IGYCRCTL,REGION=640K,COND=(12,LE),
// PARM=(NOTERM,NOSEQUENCE,LIB,XREF,DYN,'')
//SYSPRINT DD SYSOUT=(*)
//SYSIN
DD DSN=T388062.AB.C(SORTCOB1),DISP=SHR
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
file-control
i have given that assign statement in a cobol program, so i have used a cobol compiler
my cobol code is :
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLE.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT SORT-FILE
ASSIGN TO 'C:\COB\SOR.TMP'.
SELECT IN-FILE
ASSIGN TO 'C:\COB\IN.TXT'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT OUT-FILE
ASSIGN TO 'C:\COB\OUT.TXT'
ORGANIZATION IS LINE SEQUENTIAL.
my cobol code is :
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLE.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT SORT-FILE
ASSIGN TO 'C:\COB\SOR.TMP'.
SELECT IN-FILE
ASSIGN TO 'C:\COB\IN.TXT'
ORGANIZATION IS LINE SEQUENTIAL.
SELECT OUT-FILE
ASSIGN TO 'C:\COB\OUT.TXT'
ORGANIZATION IS LINE SEQUENTIAL.
You used a cobol compiler because the code is cobol source.
You appear to be somewhat lost:
From what you have posted, there is no reason to be concerned with input/output (actually input-output if i understand what you are talking about).
Your ASSIGN statements are not valid for files on the mainframe - you should assign to a ddname.
You appear to be somewhat lost:
The SELECT and ASSIGN along with the FD is how you specify a file in a cobol program.then how can i specify a disk file in cobol program?
i have seen in some books they have given disk file as input/output.
From what you have posted, there is no reason to be concerned with input/output (actually input-output if i understand what you are talking about).
Your ASSIGN statements are not valid for files on the mainframe - you should assign to a ddname.
Last edited by DikDude on Thu Sep 08, 2011 9:26 am, edited 1 time in total.
Have a good one
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
file-control
i am using IBM Personal Communications
Which has NOTHING to do with the compiler. . . What you have named is a 3270-emulator . . . This is one way people connect to a mainframe. It should have nothing to do with assigning files. . .i am using IBM Personal Communications
You need to speak with someone who actually works with cobol on your mainframe. They can show you what you have mixed up.
Last edited by DikDude on Fri Sep 09, 2011 9:04 pm, edited 1 time in total.
Have a good one
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page