View previous topic :: View next topic
|
Author |
Message |
Midhun Mohandas
New User
Joined: 03 Mar 2014 Posts: 24 Location: India
|
|
|
|
Dear all,
I want to execute a cobol-file handling program.
This is my program to read from one file and write it to another file
;
Code: |
IDENTIFICATION DIVISION.
*------------------------------------------------
PROGRAM-ID. SAMPLE.
AUTHOR. TAG.
DATE-WRITTEN. 11-03-2014.
DATE-COMPILED. 11-03-2014.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
*************************************************
* DECLARATION OF TRANSACTION FILE
**************************************************
SELECT INSERT-INPUT
ASSIGN TO DD1
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL.
SELECT WRITE-OUTPUT
ASSIGN TO DD2
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS WS-INSERT-FILE-STATUS.
*************************************************
* DATA DIVISION
*************************************************
*
DATA DIVISION.
FILE SECTION.
*************************************************
* FILE LAYOUT
*************************************************
FD INSERT-INPUT.
01 INCONTENT.
05 TXN-NUM PIC 9(3).
05 FILLER PIC X(1).
05 ISBN-NUM PIC X(10).
05 FILLER PIC X(1).
05 NO-OF-COPIES PIC 9(4).
05 FILLER PIC X(1).
05 SUB-CODE PIC X(4).
05 FILLER PIC X(56).
FD WRITE-OUTPUT.
01 INCONTENTO.
05 TXN-NUMO PIC 9(3).
05 FILLER PIC X(1).
05 ISBN-NUMO PIC X(10).
05 FILLER PIC X(1).
05 NO-OF-COPIESO PIC 9(4).
05 FILLER PIC X(1).
05 SUB-CODEO PIC X(4).
05 FILLER PIC X(56).
WORKING-STORAGE SECTION.
01 EOF-TRUE PIC 9.
01 WS-INSERT-FILE-STATUS PIC 99.
*-------------------------------------------------
**************************************************
* PROCEDURE SECTION
**************************************************
PROCEDURE DIVISION.
MAIN-PARA.
PERFORM OPEN-PARA THRU OPEN-PARA-EXIT
PERFORM PROCES-PAR THRU PROCESS-PARA-EXIT
UNTIL EOF-TRUE = 1
MOVE INCONTENT TO INCONTENTO
PERFORM CLOSE-FILE-PARA THRU CLOSE-FILE-EXIT.
STOP RUN.
*****************************************************
* OPENING THE INPUT INSERT FILE
******************************************************
OPEN-PARA.
OPEN INPUT INSERT-INPUT
OPEN OUTPUT WRITE-OUTPUT.
*----------------------------------------------------
OPEN-PARA-EXIT.
EXIT.
*****************************************************
* READING THE INPUT-INSERT FILE
*****************************************************
PROCES-PAR.
READ INSERT-INPUT INTO INCONTENTO AT END MOVE
1 TO EOF-TRUE
END-READ
WRITE INCONTENTO.
PROCESS-PARA-EXIT.
EXIT.
*********************************************
* CLOSE FILES PARA
**********************************************
CLOSE-FILE-PARA.
CLOSE INSERT-INPUT
CLOSE WRITE-OUTPUT.
*--------------------------------------------
CLOSE-FILE-EXIT.
EXIT. |
This program is working fine in MVS, ie it is successfully reading from one file and writing it to another file.
I have exported this program to OMVS region as .cbl file and have successfully compiled and link-edited it using cob2 option. But I am unable to run it, it is returning status code 35.
I compiled it using : cob2 -qlib sample.cbl ,
link-edit using : cob2 -o sampleo sample.cbl
and tried running it using : sampleo .
Now my questions are
1)In MVS I am able to give the input and output PS through runjcl but in OMVS how can I give input and output PS ?
2)Can a program running in OMVS can directly call input and output PS in MVS region or does that files needed to be exported to OMVS region?
3)If those PS needed to be exported to OMVS region, how and where should be exported?
Please answer to my questions in a simple way, because I am a beginner in OMVS |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
In Unix - which is what OMVS basically is - you specify the file name in the SELECT statement. I believe in OMVS you can use other methods but you would have to refer to the relevant manual for that. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
|