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
 

 

Reading through all members of a PDS

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

New User


Joined: 06 Sep 2005
Posts: 12

PostPosted: Thu Sep 08, 2005 12:29 pm    Post subject: Reading through all members of a PDS
Reply with quote

Problem statemet:
I want to write a search program which will read all members in a given PDS to find out those members which have a given string......

As I understand the file modes in COBOl,we cannot open directory files...

Is it possible to acieve the above mentioned problem statement through a COBOL pgm ??? Else,How what approach should we take to achive the solution ?

Also,curious to know if any of the Forum members have written a C program on Mainframe ?

Live on,
Deepak
Back to top
View user's profile Send private message

Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 464

PostPosted: Thu Sep 08, 2005 12:34 pm    Post subject: Re: Reading through all members of a PDS
Reply with quote

Hi Deepak,

If I recall your problem statement correctly then your query is

" You want to search the partiular string into a PDS"?

If it is the query then you can do this by TSO option 3.14.

Give your string and PDS name in option 3.14.


Regards
Rupesh
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 436
Location: chennai, India

PostPosted: Thu Sep 08, 2005 12:51 pm    Post subject:
Reply with quote

1.Thru LBVRS pgm in jcl ,you can search for a keyword,string all the members in a pds.We use this already built-in program

Code:

//AAAAS  JOB 1224,'88 -RADHA',MSGCLASS=H,CLASS=A, 
//             NOTIFY=AAAAS                         
//PRODLIB  EXEC PGM=LBRVS,PARM='NRJS'                 
//LIST     DD   SYSOUT=*                               
//INDEX    DD   SYSOUT=*                               
//MASTER   DD   DISP=SHR,DSN=PDS NAME
//SYSPRINT DD   SYSOUT=*                               
//OSJOB    DD   DSN=&&TEMP,DISP=(,PASS),               
//             UNIT=SYSDA,SPACE=(3120,(100,100),RLSE),
//             DCB=BLKSIZE=3120                       
//SYSIN    DD   DSN=ds containing the search string,
                DISP=SHR       




the dataset contains,

Code:
-OPT UTILITY 
-SCAN /search string/
-END         



2.Another option:Use this pgm ISRUPC

Code:
//SEARCH  EXEC PGM=ISRSUPC,                                           *
//            PARM=(SRCHCMP,                                           
//            '')                                                     
//NEWDD  DD DSN=Dataset,                                     
//          DISP=SHR                                                   
//       DD DSN=Dataset2,                                     
//          DISP=SHR                                                   
//OUTDD  DD SYSOUT=(*)                                                 
//SYSIN  DD *                                                         
SRCHFOR  'your search string'
/*   


hope this helps.
Back to top
View user's profile Send private message
itzDeepak

New User


Joined: 06 Sep 2005
Posts: 12

PostPosted: Thu Sep 08, 2005 2:06 pm    Post subject: Re: Reading through all members of a PDS
Reply with quote

Thanks for the reply..

But my question was "I want to write a search program which will read all members in a given PDS to find out those members which have a given string...... "

I was looking at how we can write a pgm which does equivalent funtion to
the tool you have mentioned
" PGM=LBRVS,PARM='NRJS' "

Basically,I want to know how we can write our program to search for a string in all the members of a PDS.

Structure of Program:
Input: 1) PDS Name
2) String Name

Output : Members in the PDS which have this string.
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 436
Location: chennai, India

PostPosted: Thu Sep 08, 2005 2:10 pm    Post subject:
Reply with quote

Quote:
Is it possible to acieve the above mentioned problem statement through a COBOL pgm ??? Else,How what approach should we take to achive the solution ?


I answered ur ELSE part which is the alternate solution for your first part.

Anyhow,i have nt written such a program till.Its better to try it at my end.
Back to top
View user's profile Send private message
Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Thu Sep 08, 2005 7:13 pm    Post subject: Re: Reading through all members of a PDS
Reply with quote

I'm not a COBOL programmer, but I would think that you could design a program to use the ISPF Library Management (LM) services: LMINIT, LMOPEN, LMMLIST, LMCLOSE, as a way to retrieve the PDS member information, and then use standard dynamic allocation routines to OPEN, READ, and CLOSE the individual members of the PDS.
Back to top
View user's profile Send private message
nitin_agr

New User


Joined: 06 Sep 2005
Posts: 28
Location: Minneapolis US

PostPosted: Sat Sep 10, 2005 2:07 am    Post subject:
Reply with quote

If possible, can anyone please explain how could we use ISPF Library Management Services through a COBOL program as mentioned by Kevin?

If one can provide any example then It will be great.
Back to top
View user's profile Send private message
Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Tue Sep 13, 2005 5:40 pm    Post subject:
Reply with quote

nitin_agr wrote:
If possible, can anyone please explain how could we use ISPF Library Management Services through a COBOL program.

Here is a sample program. This program "offloads" all the members of an 80-byte PDS to an 80-byte QSAM dataset suitable as input to the IEBUPDTE program. Again, I'm not a COBOL programmer, so it will be a little rough, but functional.

Code:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. PROG48.
       INSTALLATION.
       AUTHOR. SUPERK.
       DATE-WRITTEN. 09/12/2005.

       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.

         FILE-CONTROL.
           SELECT INFILE ASSIGN TO UT-S-SYSUT1
             ORGANIZATION IS SEQUENTIAL
             ACCESS IS SEQUENTIAL.
           SELECT OUTFILE ASSIGN TO UT-S-SYSUT2
             ORGANIZATION IS SEQUENTIAL
             ACCESS IS SEQUENTIAL.

       DATA DIVISION.
       FILE SECTION.

       FD  INFILE
           RECORDING MODE IS F
           LABEL RECORDS ARE OMITTED
           RECORD CONTAINS 80 CHARACTERS
           BLOCK CONTAINS 0 RECORDS
           DATA RECORD IS INREC.
       01  INREC                      PIC X(80).

       FD  OUTFILE
           RECORDING MODE IS F
           LABEL RECORDS ARE OMITTED
           RECORD CONTAINS 80 CHARACTERS
           BLOCK CONTAINS 0 RECORDS
           DATA RECORD IS OUTREC.
       01  OUTREC                     PIC X(80).

       WORKING-STORAGE SECTION.
       01  BPXWDYN              PIC X(08) VALUE 'BPXWDYN'.
       01  ALLOC-STRING.
           05  ALLOC-LENGTH     PIC S9(4) BINARY VALUE 80.
           05  ALLOC-DATA       PIC X(80) VALUE SPACES.
       01  VARLIST.
           03  VMEMB            PIC X(08) VALUE SPACES.
           03  VMYPDS           PIC X(08) VALUE SPACES.
       01  NVMEMB               PIC X(7) VALUE '(VMEMB)'.
       01  NVMYPDS              PIC X(8) VALUE '(VMYPDS)'.
       01  VDEFINE              PIC X(8) VALUE 'VDEFINE'.
       01  VGET                 PIC X(8) VALUE 'VGET   '.
       01  SHARED               PIC X(8) VALUE 'SHARED '.
       01  CHAR                 PIC X(8) VALUE 'CHAR   '.
       01  L8                   PIC 9(6) VALUE 8  COMP.
       01  L44                  PIC 9(6) VALUE 44 COMP.
      ******************************************************************
      *         WORKING-STORAGE FIELDS FOR ISPF SERVICE CALLS          *
      ******************************************************************
       77  ISPF-DATA-ID            PICTURE X(8)       VALUE SPACES.
       77  ISPF-DATA-LENVAR        PICTURE X(8)       VALUE SPACES.
       77  ISPF-DDNAME             PICTURE X(8)       VALUE SPACES.
       77  ISPF-DSNAME             PICTURE X(50)      VALUE SPACES.
      *    ISPF-DSNAME FIELD CAN BE INCREASED TO 56 IF NECESSARY.
       77  ISPF-ENQ-VAR            PICTURE X(8)       VALUE SPACES.
       77  ISPF-GROUP1             PICTURE X(8)       VALUE SPACES.
       77  ISPF-GROUP2             PICTURE X(8)       VALUE SPACES.
       77  ISPF-GROUP3             PICTURE X(8)       VALUE SPACES.
       77  ISPF-GROUP4             PICTURE X(8)       VALUE SPACES.
       77  ISPF-MEMBER-NAME        PICTURE X(8)       VALUE SPACES.
       77  ISPF-OPTION-LIST        PICTURE X(21)      VALUE SPACES.
       77  ISPF-OPTION1            PICTURE X(8)       VALUE SPACES.
       77  ISPF-OPTION2            PICTURE X(8)       VALUE SPACES.
       77  ISPF-OPTION3            PICTURE X(8)       VALUE SPACES.
       77  ISPF-OPTION4            PICTURE X(8)       VALUE SPACES.
       77  ISPF-OPTION5            PICTURE X(8)       VALUE SPACES.
       77  ISPF-ORG-VAR            PICTURE X(8)       VALUE SPACES.
       77  ISPF-PROJECT            PICTURE X(8)       VALUE SPACES.
       77  ISPF-PSWD-VALUE         PICTURE X(8)       VALUE SPACES.
       77  ISPF-RECFORM            PICTURE X(8)       VALUE SPACES.
       77  ISPF-SERIAL             PICTURE X(6)       VALUE SPACES.
       77  ISPF-SERVICE            PICTURE X(8)       VALUE SPACES.
       77  ISPF-TYPE               PICTURE X(8)       VALUE SPACES.
       77  ISPF-UDATA-VALUE        PICTURE X(8)       VALUE SPACES.
      ******************************************************************
      *       END OF WORKING-STORAGE FIELDS FOR ISPF SERVICE CALLS     *
      ******************************************************************

       LINKAGE SECTION.
       01  PARM.
           03  PARM-LENGTH             PIC S9(04) COMP SYNC.
           03  THE-PARM.
               05  THE-PDSNAME         PIC X(44).

       PROCEDURE DIVISION USING PARM.
           CALL 'ISPLINK' USING VDEFINE NVMEMB VMEMB CHAR L8.
           DISPLAY 'VDEFINE=' RETURN-CODE.
           CALL 'ISPLINK' USING VDEFINE NVMYPDS VMYPDS CHAR L8.
           DISPLAY 'VDEFINE=' RETURN-CODE.

           MOVE 'LMINIT  ' TO ISPF-SERVICE.
           MOVE 'VMYPDS  ' TO ISPF-DATA-ID.
           MOVE '        ' TO ISPF-PROJECT.
           MOVE '        ' TO ISPF-GROUP1.
           MOVE '        ' TO ISPF-GROUP2.
           MOVE '        ' TO ISPF-GROUP3.
           MOVE '        ' TO ISPF-GROUP4.
           MOVE '        ' TO ISPF-TYPE.
           INSPECT THE-PDSNAME
             REPLACING ALL LOW-VALUES BY SPACES.
           INSPECT THE-PDSNAME
             REPLACING ALL HIGH-VALUES BY SPACES.
           STRING "'" DELIMITED BY SPACE
                  THE-PDSNAME DELIMITED BY SPACE
                  "'" DELIMITED BY SPACE
                  INTO ISPF-DSNAME.
           MOVE '        ' TO ISPF-DDNAME.
           MOVE '      '   TO ISPF-SERIAL.
           MOVE '        ' TO ISPF-PSWD-VALUE.
           MOVE 'SHR     ' TO ISPF-ENQ-VAR.
           MOVE '        ' TO ISPF-ORG-VAR.
           CALL 'ISPLINK' USING  ISPF-SERVICE     ISPF-DATA-ID
                                 ISPF-PROJECT     ISPF-GROUP1
                                 ISPF-GROUP2      ISPF-GROUP3
                                 ISPF-GROUP4      ISPF-TYPE
                                 ISPF-DSNAME      ISPF-DDNAME
                                 ISPF-SERIAL      ISPF-PSWD-VALUE
                                 ISPF-ENQ-VAR     ISPF-ORG-VAR.

           DISPLAY 'LMINIT=' RETURN-CODE.

           MOVE 'LMOPEN  ' TO ISPF-SERVICE.
           MOVE VMYPDS     TO ISPF-DATA-ID.
           MOVE 'INPUT   ' TO ISPF-OPTION1.
           MOVE '        ' TO ISPF-DATA-LENVAR.
           MOVE '        ' TO ISPF-RECFORM.
           MOVE '        ' TO ISPF-ORG-VAR.
           CALL 'ISPLINK' USING  ISPF-SERVICE       ISPF-DATA-ID
                                 ISPF-OPTION1       ISPF-DATA-LENVAR
                                 ISPF-RECFORM       ISPF-ORG-VAR.

           DISPLAY 'LMOPEN=' RETURN-CODE.

           PERFORM P001-PROCESS-MEMBER THRU P001-EXIT.

           MOVE 'LMCLOSE ' TO ISPF-SERVICE.
           CALL 'ISPLINK' USING  ISPF-SERVICE  ISPF-DATA-ID.

           DISPLAY 'LMCLOSE=' RETURN-CODE.

           MOVE ZEROS TO RETURN-CODE.
           STOP RUN.

       P001-PROCESS-MEMBER.
           MOVE 'LMMLIST ' TO ISPF-SERVICE.
           MOVE 'LIST    ' TO ISPF-OPTION1.
           MOVE 'VMEMB   ' TO ISPF-MEMBER-NAME.
           MOVE 'NO      ' TO ISPF-OPTION2.
           CALL 'ISPLINK' USING  ISPF-SERVICE       ISPF-DATA-ID
                                 ISPF-OPTION1       ISPF-MEMBER-NAME
                                 ISPF-OPTION2.
           IF RETURN-CODE IS EQUAL TO ZEROS
             DISPLAY 'LMMLIST=' RETURN-CODE
             PERFORM P002-READ-AND-WRITE THRU P002-EXIT
             GO TO P001-PROCESS-MEMBER
           ELSE
             GO TO P001-EXIT.
       P001-EXIT.
           EXIT.

       P002-READ-AND-WRITE.
           MOVE SPACES TO ALLOC-DATA.
           STRING "ALLOC DD(SYSUT1) DA('" DELIMITED BY SIZE
                  THE-PDSNAME DELIMITED BY SPACES
                  "(" DELIMITED BY SIZE
                  VMEMB DELIMITED BY SPACES
                  ")') SHR" DELIMITED BY SIZE
             INTO ALLOC-DATA.
           CALL BPXWDYN USING ALLOC-STRING.
           OPEN INPUT INFILE, OUTPUT OUTFILE.
           MOVE SPACES TO OUTREC.
           STRING './' DELIMITED BY SPACES
                  '      ' DELIMITED BY SIZE
                  'ADD   NAME=' DELIMITED BY SIZE
                  VMEMB DELIMITED BY SPACES
             INTO OUTREC.
             WRITE OUTREC.
       P002-NEXT.
           READ INFILE
             AT END GO TO P002-EXIT.
           MOVE INREC TO OUTREC.
           WRITE OUTREC.
           GO TO P002-NEXT.
       P002-EXIT.
           CLOSE INFILE , OUTFILE.
           EXIT.
Back to top
View user's profile Send private message
Anbudan

New User


Joined: 07 Sep 2005
Posts: 26
Location: Germany

PostPosted: Thu Sep 15, 2005 7:04 pm    Post subject:
Reply with quote

Hi itzDeepak


This may help you

1)Using Jcl create a PS that contains all the values of PDS
2)Write a cobol program, the above PS is the input datei
3)Inside the pgm, search the field
4)Display or write the output on a output datei


Regarding point 1, if u don't know the jcl,

ask me. I will give



Don't hesitate to ask





Anbudan
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
No new posts Reading data from PS file and send it... rajatbagga All Other Mainframe Topics 18 Fri Sep 23, 2016 12:51 pm
No new posts Reading selected volumes of a multi-v... RickBig JCL & VSAM 6 Wed Jul 13, 2016 7:26 pm
No new posts Single step utility for compare and u... ramprakashn JCL & VSAM 5 Fri Apr 29, 2016 3:43 pm
No new posts Differences between copying members b... E.LAI TSO/ISPF 8 Wed Mar 30, 2016 12:35 pm
No new posts JCL to replace string in all PDS members bhamarekm All Other Mainframe Topics 8 Thu May 28, 2015 8:44 pm


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