View previous topic :: View next topic
|
Author |
Message |
ankoo
New User
Joined: 12 Jun 2010 Posts: 31 Location: India
|
|
|
|
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. STU.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT STU-DETAIL1 ASSIGN TO FLAT1.
SELECT STU-DETAIL2 ASSIGN TO FLAT2.
SELECT STU-DETAIL0 ASSIGN TO FLAT3.
DATA DIVISION.
FILE SECTION.
FD STU-DETAIL1.
01 STU-DETAIL1-REC.
05 NAME PIC X(10).
05 ROLLNO PIC 9(4).
05 DEPT PIC X(4).
05 FILLER PIC X(62).
FD STU-DETAIL2.
01 STU-DETAIL2-REC.
05 NAME2 PIC X(10).
05 ROLLNO2 PIC 9(4).
05 VEHNO PIC X(2).
05 FILLER PIC X(64).
FD STU-DETAIL0.
01 STU-DETAIL0-REC.
05 NAME0 PIC X(10).
05 ROLLNO0 PIC 9(4).
05 DEPT0 PIC X(4).
05 VEHNO0 PIC X(2).
05 FILLER PIC X(60).
PROCEDURE DIVISION.
0000-MAIN-PARA.
PERFORM 1000-INITIALIZATION.
PERFORM 2000-PROCESS.
PERFORM 3000-CLOSE.
PERFORM 9999-EXIT.
1000-INITIALIZATION.
OPEN INPUT STU-DETAIL1.
OPEN INPUT STU-DETAIL2.
OPEN OUTPUT STU-DETAIL0.
2000-PROCESS.
READ STU-DETAIL1
READ STU-DETAIL2
IF ROLLNO = ROLLNO2
MOVE NAME TO NAME0
MOVE ROLLNO TO ROLLNO0
MOVE DEPT TO DEPT0
MOVE VEHNO TO VEHNO0
WRITE STU-DETAIL0-REC.
END-IF.
3000-CLOSE.
CLOSE STU-DETAIL1.
CLOSE STU-DETAIL2.
CLOSE STU-DETAIL0.
9999-EXIT.
STOP RUN. |
I am using the above cobol code, but getting an abend saying
Code: |
********************************* TOP OF DATA **********************************
IGZ0035S There was an unsuccessful OPEN or CLOSE of file FLAT1 in program STU at
FILE STATUS nor an ERROR declarative were specified. The status code wa
From compile unit STU at entry point STU at compile unit offset +000004
address 1CD009BE.
******************************** BOTTOM OF DATA ******************************** |
|
|
Back to top |
|
|
Joel.B
New User
Joined: 13 Oct 2007 Posts: 5 Location: India
|
|
|
|
Check to make sure there is a ddname defined for the indicated file. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
There is a manual link at the top of the page. Click on it, find the COBOL Language Reference manual, and read it -- cover to cover -- then go back and rewrite your program to include file status clauses for every file. Then put code in to actually look at the file status codes when you do an open, read, write, or anything else with a file. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
You seem to be attempting to write/learn COBOL and JCL on the fly.
Seriously - my rec is that you take an actual class (or 2 (or 3 ...)) with a human instructor.
Your errors above (both posts) are very elemental. Linking the file name in COBOL to the dataset in the JCL is covered early in any intro class.
This may be too complicated to learn otherwise.
Good luck. |
|
Back to top |
|
|
ankoo
New User
Joined: 12 Jun 2010 Posts: 31 Location: India
|
|
|
|
I used File Status in the cobol code like this
Code: |
SELECT STU-DETAIL1 ASSIGN TO FLAT1
STATUS IS FS1.
SELECT STU-DETAIL2 ASSIGN TO FLAT2
STATUS IS FS2.
SELECT STU-DETAIL0 ASSIGN TO FLAT3
STATUS IS FS3. |
Now after the runjcl MaxCC=0 is coming, but after using the LABEL RECORDS as below MAXCC=12 is coming
Code: |
FD STU-DETAIL1.
LABEL RECORDS ARE STANDARD
--1----+----2----+----3----+----4----+----5----+
LABEL RECORDS ARE STANDARD
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS.
01 STU-DETAIL1-REC.
05 NAME PIC X(10).
05 ROLLNO PIC 9(4).
05 DEPT PIC X(4).
05 FILLER PIC X(62).
FD STU-DETAIL2.
LABEL RECORDS ARE STANDARD
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS.
01 STU-DETAIL2-REC.
05 NAME2 PIC X(10).
05 ROLLNO2 PIC 9(4).
05 VEHNO PIC X(2). |
and the messsage in spool is
Code: |
15 IGYDS1089-S "LABEL" was invalid. Scanning was resumed at the next are was resumed at the next area "A" item, level-number, or the start of the next clause. |
|
|
Back to top |
|
|
ankoo
New User
Joined: 12 Jun 2010 Posts: 31 Location: India
|
|
|
|
And look who's new to the post of GOD "PeterHolland!!!!" |
|
Back to top |
|
|
|