Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to create PDS from a cobol program??

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Narismha

New User


Joined: 22 Nov 2006
Posts: 23
Location: Mumbai

PostPosted: Fri Mar 23, 2007 4:38 pm    Post subject: How to create PDS from a cobol program??
Reply with quote

Can any one explain/send me the tip to create PDS and members in it(Dynamically) through the cobol program.

Regards
-Narisimha
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Mar 23, 2007 6:44 pm    Post subject: Re: How to create PDS from a cobol program??
Reply with quote

This is my very rudimentary sample:
Code:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. PDSPROG.
       INSTALLATION.

       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.

         FILE-CONTROL.
           SELECT PDS-FILE ASSIGN TO PDS
             ORGANIZATION IS SEQUENTIAL
             ACCESS IS SEQUENTIAL.

       DATA DIVISION.
       FILE SECTION.

       FD  PDS-FILE
           LABEL RECORD STANDARD
           BLOCK 0 RECORDS
           RECORDING MODE F
           RECORD CONTAINS 80 CHARACTERS.
       01 PDS-RECORD                   PIC X(80).

       WORKING-STORAGE SECTION.
       01  FILLER.
           05  WS-DUMMY                PIC S9(8) COMP.
           05  WS-RETURN-CODE          PIC S9(8) COMP.
           05  WS-REASON-CODE          PIC S9(8) COMP.
           05  WS-INFO-CODE            PIC S9(8) COMP.
           05  WS-CPPL-ADDRESS         PIC S9(8) COMP.
           05  WS-FLAGS                PIC X(4) VALUE X'00010001'.
           05  WS-BUFFER               PIC X(256).
           05  WS-LENGTH               PIC S9(8) COMP VALUE 256.
       01  DSN                         PIC X(44) VALUE SPACE.

       PROCEDURE DIVISION.
           CALL 'IKJTSOEV' USING WS-DUMMY WS-RETURN-CODE WS-REASON-CODE
             WS-INFO-CODE WS-CPPL-ADDRESS.
           IF WS-RETURN-CODE > ZERO
             DISPLAY 'IKJTSOEV FAILED, RETURN-CODE=' WS-RETURN-CODE
             ' REASON-CODE=' WS-REASON-CODE 'INFO-CODE=' WS-INFO-CODE
             MOVE WS-RETURN-CODE TO RETURN-CODE
             STOP RUN.

           MOVE 'PDS.DATASET.NAME' TO DSN.
           MOVE SPACE TO WS-BUFFER.
           STRING
             'ALLOC DD(PDS) DA('
             QUOTE
               DELIMITED BY SIZE
             DSN
               DELIMITED BY SPACE
             QUOTE
             ') NEW REU RECFM(F B) LRECL(80) '
             'DIR(255) SPACE(10,10) CYLINDERS'
               DELIMITED BY SIZE
           INTO WS-BUFFER.

           CALL 'IKJEFTSR' USING WS-FLAGS WS-BUFFER WS-LENGTH
             WS-RETURN-CODE WS-REASON-CODE WS-DUMMY.
           DISPLAY WS-BUFFER.
           IF WS-RETURN-CODE > ZERO
             DISPLAY 'IKJEFTSR FAILED, RETURN-CODE=' WS-RETURN-CODE
             ' REASON-CODE=' WS-REASON-CODE
             MOVE WS-RETURN-CODE TO RETURN-CODE
             STOP RUN.

           MOVE SPACE TO WS-BUFFER.
           STRING
             'ALLOC DD(PDS) DA('
             QUOTE
               DELIMITED BY SIZE
             DSN
               DELIMITED BY SPACE
             '(#1)'
             QUOTE
             ') SHR REU'
               DELIMITED BY SIZE
           INTO WS-BUFFER.

           CALL 'IKJEFTSR' USING WS-FLAGS WS-BUFFER WS-LENGTH
             WS-RETURN-CODE WS-REASON-CODE WS-DUMMY.
           DISPLAY WS-BUFFER.
           IF WS-RETURN-CODE > ZERO
             DISPLAY 'IKJEFTSR FAILED, RETURN-CODE=' WS-RETURN-CODE
             ' REASON-CODE=' WS-REASON-CODE
             MOVE WS-RETURN-CODE TO RETURN-CODE
             STOP RUN.

           OPEN OUTPUT PDS-FILE.
           MOVE SPACE TO PDS-RECORD.
           WRITE PDS-RECORD.
           CLOSE PDS-FILE.

           MOVE SPACE TO WS-BUFFER.
           STRING
             'FREE DD(PDS)'
               DELIMITED BY SIZE
           INTO WS-BUFFER.

           CALL 'IKJEFTSR' USING WS-FLAGS WS-BUFFER WS-LENGTH
             WS-RETURN-CODE WS-REASON-CODE WS-DUMMY.
           DISPLAY WS-BUFFER.
           IF WS-RETURN-CODE > ZERO
             DISPLAY 'IKJEFTSR FAILED, RETURN-CODE=' WS-RETURN-CODE
             ' REASON-CODE=' WS-REASON-CODE
             MOVE WS-RETURN-CODE TO RETURN-CODE
             STOP RUN.

           MOVE ZERO TO RETURN-CODE.
           STOP RUN.


Note: this program won't run properly in a TSO environment. If you want to run it in TSO, just eliminate the first step where the TSO environment (IKJTSOEV ) is being setup.
Back to top
View user's profile Send private message
Narismha

New User


Joined: 22 Nov 2006
Posts: 23
Location: Mumbai

PostPosted: Mon Mar 26, 2007 11:18 am    Post subject:
Reply with quote

Hi Superk,

Thank you for your quick reply. As per the above code i should get the PDS 'PDS.DATASET.NAME(#1)' . But i did not get any data set.

Can you please let me know what JCL i have to use.

I used the DD card for this PDS as //PDS dd dummy

PLease help me on this.

Thanks
-Narisimha
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Mon Mar 26, 2007 9:47 pm    Post subject: Re: How to create PDS from a cobol program??
Reply with quote

The only necessary DD for this program is SYSOUT, so you can see any possible error messages. Nothing else is needed.
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 149
Location: Ottawa Canada

PostPosted: Wed Mar 28, 2007 8:28 pm    Post subject:
Reply with quote

I have not tried superk's solution. It looks to me like this is a great way to do it if you can get it to work.

Where I work we have a utility that lets COBOL call REXX. One possible approach would be to call a REXX program to allocate the PDS.

We have being using the PUTENV approach to do most of our dynamic file allocations but I don't know whether PUTENV can handle a PDS (I suspect it cannot). The PUTENV approach is very easy.

Of course you can use Assembler to do what you want. We have an assembler routine that allocates a PDS member.
Back to top
View user's profile Send private message
jasorn

Active User


Joined: 12 Jul 2006
Posts: 153
Location: USA

PostPosted: Mon Apr 02, 2007 4:40 pm    Post subject:
Reply with quote

This doesn't have syntax hilighting but I think it's a good, free, multiplatform, cobol editor for those of us who like spf editors.

http://www.geocities.jp/sakachin2/index.htm
Back to top
View user's profile Send private message
jasorn

Active User


Joined: 12 Jul 2006
Posts: 153
Location: USA

PostPosted: Tue Apr 03, 2007 12:23 pm    Post subject: Moderators, you can remove my post about the editor.
Reply with quote

jasorn wrote:
This doesn't have syntax hilighting but I think it's a good, free, multiplatform, cobol editor for those of us who like spf editors.

http://www.geocities.jp/sakachin2/index.htm


I don't know what I was answering but apparently I put this in the wrong thread. But it is a GREAT editor.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Apr 03, 2007 9:48 pm    Post subject:
Reply with quote

I hate it when i do that. . . icon_smile.gif
Back to top
View user's profile Send private message
mainframe_96

New User


Joined: 18 Dec 2006
Posts: 13
Location: usa

PostPosted: Thu Apr 05, 2007 1:22 am    Post subject: Re: How to create PDS from a cobol program??
Reply with quote

If you absolutely need to create the pds in the cobol Program itself then this is not the solution. However you can create an 80 byte sequential file that you can copy into a pds after the completion

Create the file like this

FD xxxxx
BLOCK CONTAINS 0 RECORDS,
RECORDING MODE IS F
LABEL RECORDS ARE STANDARD,
DATA RECORD IS xxxxx-Copy-RECORD.

01 xxxx-COpy-RECORD PIC X(80).


then use Iebgener.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Apr 05, 2007 1:36 am    Post subject:
Reply with quote

Hello,

Which of the above is not the solution?

You really can create a pds from within a COBOL program. . . Not somethng you would do just every day, but it is do-able.
Back to top
View user's profile Send private message
Narismha

New User


Joined: 22 Nov 2006
Posts: 23
Location: Mumbai

PostPosted: Mon Apr 09, 2007 8:50 pm    Post subject:
Reply with quote

Hi All,

Thanks for all your inputs.

Through REXX is a good solution, but i have created PS files dynamically.

Thanks and Regards
-Narisimha
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us