IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Problem in executing cobol-file handling programs in OMVS


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Midhun Mohandas

New User


Joined: 03 Mar 2014
Posts: 24
Location: India

PostPosted: Wed Mar 12, 2014 5:41 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Mar 13, 2014 4:21 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Mar 13, 2014 1:48 pm
Reply with quote

googling with UNIX COBOL SELECT CLAUSE will return many useful links

anyway the best reference is
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG40/CCONTENTS?SHELF=EZ2ZS20M&DN=SC23-8529-00&DT=20071214180654


chapters 2.2 and 2.3
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top