MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reading PDS Members
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
naveen_mehatak@hotmail.co
Beginner


Joined: 11 Apr 2007
Posts: 6
Topics: 0

PostPosted: Thu Apr 12, 2007 1:48 pm    Post subject: Reply with quote

Thanks Kolusu,

one more...

can i use this call in a loop..and write records in the latest file allocated.

now looks like only first one file is created and write is happening in the same file.

the reult..one file is crested with the data which is suppose to be in the nth file.

Thanks
Naveen
Back to top
View user's profile Send private message
Bill Dennis
Advanced


Joined: 03 Dec 2002
Posts: 579
Topics: 1
Location: Iowa, USA

PostPosted: Thu Apr 12, 2007 4:20 pm    Post subject: Reply with quote

Do you CLOSE the file and re-OPEN between member name changes?
_________________
Regards,
Bill Dennis

Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity.
Back to top
View user's profile Send private message
naveen_mehatak@hotmail.co
Beginner


Joined: 11 Apr 2007
Posts: 6
Topics: 0

PostPosted: Thu Apr 12, 2007 5:34 pm    Post subject: Reply with quote

yes bill

i close , free then reopen it.

but when i open it as

open output => file status 96
open extend => file status 35

Rolling Eyes
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Apr 13, 2007 6:05 am    Post subject: Reply with quote

naveen_mehatak@hotmail.co wrote:
yes bill

i close , free then reopen it.

but when i open it as

open output => file status 96
open extend => file status 35

Rolling Eyes


naveen,

did you read my last post? you are getting a file status of 96 because of CBLQDA(OFF) runtime option was specified. CBLQDA is the run time option which lets you dynamically allocate files.

You should set to CBLQDA(ON). search the application forum for CBLQDA

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
naveen_mehatak@hotmail.co
Beginner


Joined: 11 Apr 2007
Posts: 6
Topics: 0

PostPosted: Fri Apr 13, 2007 12:06 pm    Post subject: Reply with quote

yes Kolusu I did...few question on thet

1.if i want to use the file crested dynamically in the next JCl step.

is BPXWDYN call the right option.

2.if yes how CBLQDA = new delete delete.....will help

3.if no do we have a option to create file which could be used later.

as of now with the sring below i am getting a return code of 4062/63 for the
BPXWDYN call

ALLOC DD(OUTFILE) DSN('FBS205.1234.NAV1') NEW CYL SPACE(1,1) UNIT(SYSDA) DELETE BLKSIZE(3800) LRECL(380) RECFM(F,B) DSOR
G(PS) REUSE SHORTRC


Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Sat Apr 14, 2007 7:40 am    Post subject: Reply with quote

naveen_mehatak@hotmail.co,

1. I don't have sufficient information on your requirements. So cannot comment on that.

2. No idea as to what you are talking

3. Didyou change the length field when you moved the value to the alloc text? Make sure that you move the right value. The examples above shows 100 , you might have exceeded that.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
naveen_mehatak@hotmail.co
Beginner


Joined: 11 Apr 2007
Posts: 6
Topics: 0

PostPosted: Mon Apr 16, 2007 12:43 pm    Post subject: Reply with quote

Kolusu,

3.The text field length was taken care of.so that was not the problem.

1.based on a given input file I need to decide how many files i need to create DYNAMICALLY and write corresponding recs in those files.these files are fed to another system.
i want to do these with out REXX. better if its in the program.

2.so because i want these files in the next step.
my question was when CBLQDA=ON is set the file disp is set to (new ,delete,delete)
so will i have the file after the program ends.

Thanks
Naveen
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Apr 16, 2007 1:04 pm    Post subject: Reply with quote

naveen_mehatak@hotmail.co,

Quote:

The text field length was taken care of.so that was not the problem


If you taken care of the length , then you should not have got the error at all. You must have specified something wrong.

Quote:

so because i want these files in the next step.
my question was when CBLQDA=ON is set the file disp is set to (new ,delete,delete)
so will i have the file after the program ends.


CBLQDA is has got nothing to do with your DISP paramaeter. If you code new,delete,delete then after completion of the step the dataset will be deleted.

CBLQDA is a language environment variable which dynamically allocates a temp dataset when the QSAM file is unavailable. You also need the CBLQDA parm even though you are explicitly allocating the files.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
naveen_mehatak@hotmail.co
Beginner


Joined: 11 Apr 2007
Posts: 6
Topics: 0

PostPosted: Mon Apr 16, 2007 2:13 pm    Post subject: Reply with quote

1.Yes somethign is wrong.It worked for me the first time.now it returns this code.

2.Thanks for the info on CBLQDA. Please let me know how do we set CBLQDA if I am using program DFSRRC00 to run my program.

Thanks
Naveen
Back to top
View user's profile Send private message
Eric.C.Bakke
Beginner


Joined: 14 Jul 2008
Posts: 15
Topics: 0
Location: Plano, TX

PostPosted: Wed Jul 16, 2008 5:14 pm    Post subject: Reply with quote

I'm new to this forum and appreciate the info in this post.

I've created a program that reads a pds directory and the subsequently reads each pds member record.

If your interested, the code is as follows:

Code:


 IDENTIFICATION DIVISION.                                         
 PROGRAM-ID.     PDSREAD.                                         
******************************************************************
**                                                              **
** PROGRAM TITLE: PDSREAD                                       **
**                                                              **
** PROGRAM PURPOSE: THIS COBOL PROGRAM IS A TEST PROGRAM THAT   **
** READS THE DIRECTORY MEMBERS OF A PDS DATASET AND THEN        **
** FOR EACH MEMBER DYNAMICALLY ALLOCATES A FILE TO BE OPENED    **
** AND READ TO DISPLAY THE PDS CONTENTS TO SYSOUT.              **
**                                                              **
** INPUT FILES: PDS-DATASET     SYS010                          **
**              IN-PDS          INFILE (DYNAMICALLY ASSIGNED)   **
**                                                              **
** OUTPUT FILES: SYSOUT                                         **
**                                                              **
** LINKAGE PARMS: NONE                                          **
**                                                              **
**                                                              **
******************************************************************
** MODIFICATION LOG:                                            **
******************************************************************
** ANALYST  DATE  CHANGE DESCRIPTION                            **
** ------- ------ ----------------------------------------------**
** EBAKKE  071608 ORIGINAL CREATION                             **
******************************************************************
                                                                 
 ENVIRONMENT DIVISION.                                           
 CONFIGURATION SECTION.                                           
 SOURCE-COMPUTER. IBM-370.                                       
 OBJECT-COMPUTER. IBM-370.                                       
                                                                 
 INPUT-OUTPUT SECTION.                                           
 FILE-CONTROL.                                                   
                                                                 
     SELECT PDS-DATASET                        ASSIGN TO UT-S-PDS.
                                                                 
     SELECT IN-PDS                             ASSIGN TO INFILE. 

 DATA DIVISION.

 FILE SECTION.

 FD  PDS-DATASET.

 01  PDS-DIRECTORY.
     05 USED-BYTES                     PIC S9(4) COMP.
     05 REST-OF-RECORD                 PIC X(254).

 FD  IN-PDS
     RECORDING MODE IS F
     BLOCK CONTAINS 0 RECORDS
     RECORD CONTAINS 80 CHARACTERS
     LABEL RECORDS ARE STANDARD.

 01  IN-REC                            PIC X(080).


 WORKING-STORAGE SECTION.

* CONSTANTS
 77  BPXWDYN                          PIC X(08) VALUE 'BPXWDYN'.
 77  CLEANUP                          PIC S9(9) COMP SYNC VALUE 1.

* DIRECTORY ENTRY LAYOUT
 01  DIRECTORY-ENTRY.
     05 MEMBER-NAME                    PIC X(8).
     05 FILLER                         PIC X(3).
     05 WS-INDC                        PIC X.

* PDS ALLOCATION STRING
 01  PDS-STRING.
     05 PDS-LENGTH                     PIC S9(4) COMP VALUE 100.
     05 PDS-TEXT                       PIC X(100).

* WORK FIELD FOR PARSING THRU DIRECTORY RECORDS
 01  WG-WORK-FIELD.
     05 WG-WORK-FIELD-NUMERIC          PIC S9(4) COMP.

* GENERAL WORKING STORAGE VARIABLES
 01  WG-GENERAL-WORKAREA.
     05 WG-IX-1                        PIC S9(4) COMP.
     05 WG-TRASH                       PIC S9(4) COMP.
     05 WG-HALF-WORDS                  PIC S9(4) COMP.
     05 WG-ABEND-CODE                  PIC S9(9) COMP.

* 88-LEVEL SWITCHES
 01  WS-SWITCHES.
     05 END-OF-DIRECTORY-SW            PIC X VALUE 'N'.
        88 EOF-DIRECTORY                     VALUE 'Y'.
     05 END-OF-MEMBER-SW               PIC X VALUE 'N'.
        88 EOF-MEMBER                        VALUE 'Y'.

 LINKAGE SECTION.
 01  LINK-PARM.
     05 PARM-LENGTH                    PIC S9(4) COMP.
     05 PARM-TEXT                      PIC X(44).

 PROCEDURE DIVISION USING LINK-PARM.

     DISPLAY ' '.
     DISPLAY 'PROCESSING PDS FILE ' PARM-TEXT.

     PERFORM 0100-INITIALIZATION.

     PERFORM 0200-PROCESS-LOOP UNTIL EOF-DIRECTORY.

     PERFORM 0300-FINALIZATION.

     STOP RUN.

******************************************************************
* 0100-INITIALIZATION                                            *
******************************************************************
 0100-INITIALIZATION.
* CHECK INPUT PARM FOR DATA THAT IS UP TO MAX DSN SIZE OF 44 BYTES
     IF PARM-LENGTH < 1 OR PARM-LENGTH > 44
        DISPLAY 'INVALID INPUT PARM LENGTH' PARM-LENGTH
        MOVE 1 TO WG-ABEND-CODE
        PERFORM 9999-ABEND
     END-IF.

* OPEN INPUT PDS DATASET
     OPEN INPUT PDS-DATASET.

* DO PRIMING READ OF PDS DATASET
     PERFORM 8000-READ-DIRECTORY.

******************************************************************
* 0200-PROCESS-LOOP                                              *
******************************************************************
 0200-PROCESS-LOOP.

* PROCESS EACH DIRECTORY ENTRY LISTING THE MEMBERS NAME AND
* CONTENTS TO SYSOUT
     MOVE 1 TO WG-IX-1.
     PERFORM
      UNTIL USED-BYTES - WG-IX-1 < 11 OR
            REST-OF-RECORD (WG-IX-1:1) = HIGH-VALUES
       MOVE REST-OF-RECORD (WG-IX-1:12) TO DIRECTORY-ENTRY
       PERFORM 1000-PROCESS-MEMBER
       INITIALIZE WG-WORK-FIELD
       MOVE WS-INDC TO WG-WORK-FIELD (2:1)
       DIVIDE WG-WORK-FIELD-NUMERIC BY 32 GIVING WG-TRASH
        REMAINDER WG-HALF-WORDS
       COMPUTE WG-IX-1 = WG-IX-1 + 12 + WG-HALF-WORDS * 2
     END-PERFORM.

* READ NEXT DIRECTORY RECORD IF NOT DONE YET
     IF REST-OF-RECORD (WG-IX-1:1) = HIGH-VALUES
        SET EOF-DIRECTORY TO TRUE
     ELSE
        PERFORM 8000-READ-DIRECTORY
     END-IF.

******************************************************************
* 0300-FINALIZATION                                              *
******************************************************************
 0300-FINALIZATION.

* CLOSE PDS DATASET USED FOR ACCESSING DIRECTORY RECORDS.
     CLOSE PDS-DATASET.

******************************************************************
* 1000-PROCESS-MEMBER                                            *
******************************************************************
 1000-PROCESS-MEMBER.

* DISPLAY MEMBER NAME TO SYSOUT
     DISPLAY '** PROCESSING MEMBER ''' MEMBER-NAME ''' **'.

* INITIALIZE STUFF FORE EACH DIRECTORY MEMBER
     MOVE SPACES TO PDS-TEXT, END-OF-MEMBER-SW.

* STRING TOGETHER THE PDS ALLOCATION STRING WITH MEMBER NAME
     STRING
        'ALLOC DD(INFILE) DSN(''' DELIMITED BY SIZE
        PARM-TEXT (1:PARM-LENGTH) DELIMITED BY SIZE
        '('                       DELIMITED BY SIZE
        MEMBER-NAME     DELIMITED BY ' '
        ')'') SHR REUSE'   DELIMITED BY SIZE
       INTO PDS-TEXT.

* DYNAMICALLY ALLOCATE PDS DATASET WITH MEMBER AS IN-PDS FILE
     CALL BPXWDYN USING PDS-STRING.

* CHECK RETURN CODE AND ABEND IF CAN'T ALLOCATE DATASET
     IF RETURN-CODE = 0
        CONTINUE
     ELSE
        DISPLAY 'ALLOC FAILED, RETURN-CODE WAS ' RETURN-CODE
        MOVE 2 TO WG-ABEND-CODE
        PERFORM 9999-ABEND
     END-IF.

* OPEN IN-PDS FILE TO START READING MEMBER RECORDS
     OPEN INPUT IN-PDS.

* DISPLAY EACH MEMBER RECORD UNTIL THE END IS REACHED
     DISPLAY ' MEMBER RECORDS ARE: '.
     PERFORM 8100-READ-MEMBER UNTIL EOF-MEMBER.
     DISPLAY ' '.

* CLOSE DYNAMICALLY ALLOCATED IN-PDS FILE
     CLOSE IN-PDS.

******************************************************************
* 8000-READ-DIRECTORY                                            *
******************************************************************
 8000-READ-DIRECTORY.

     READ PDS-DATASET
       AT END
         SET EOF-DIRECTORY TO TRUE.

******************************************************************
* 8100-READ-MEMBER.                                              *
******************************************************************
 8100-READ-MEMBER.

     READ IN-PDS
       AT END SET EOF-MEMBER TO TRUE
       NOT AT END
          DISPLAY IN-REC.

******************************************************************
* 9999-ABEND.                                                    *
******************************************************************
 9999-ABEND.
     CALL 'CEE3ABD' USING WG-ABEND-CODE, CLEANUP.


Use the following JCL to execute the above:

Code:

//JS001    EXEC PGM=IKJEFT1B,REGION=0M
//STEPLIB  DD DSN={your.loadlib},DISP=SHR
//PDS      DD DSN={your.pds.dataset},DISP=SHR,RECFM=U,LRECL=256
//SYSOUT   DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN  DD *
 DSN SYSTEM(DSN)
    RUN PROGRAM(PDSREAD) PARM('{your pds dataset}')
 END
//* END OF JCL

_________________
Eric C. Bakke
Senior DB2 DBA


Last edited by Eric.C.Bakke on Mon Jul 21, 2008 3:11 pm; edited 1 time in total
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed Jul 16, 2008 9:22 pm    Post subject: Reply with quote

Nice. Since I can barely spell "COBOL" (hope I got that right!) I'm curious about the use of TSO and the DSN command. Wouldn't PGM=PDSREAD,PARM='dsname' be sufficient? I don't pretend to understand the ASSIGN stuff in COBOL, but I didn't see anything that directly associated the file definition for the directory with a ddname.
_________________
New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html.
Back to top
View user's profile Send private message Visit poster's website
Eric.C.Bakke
Beginner


Joined: 14 Jul 2008
Posts: 15
Topics: 0
Location: Plano, TX

PostPosted: Thu Jul 17, 2008 10:01 am    Post subject: Reply with quote

Yes, you could replace IKJEFT1B with this...I'm a DB2 DBA so I'm used to using the batch TSO method...both work the same.
_________________
Eric C. Bakke
Senior DB2 DBA
Back to top
View user's profile Send private message
Eric.C.Bakke
Beginner


Joined: 14 Jul 2008
Posts: 15
Topics: 0
Location: Plano, TX

PostPosted: Thu Jul 17, 2008 10:08 am    Post subject: Reply with quote

One more thing...I realized that I left the DB2 connection to DSN in my example JCL after I posted it but since I'm not allowed to edit my posts I couldn't change it. You should probably use the direct method instead of doing the DB2 connections unless you have DB2 work to do with the PDS members. Sorry for any confusion here.
_________________
Eric C. Bakke
Senior DB2 DBA
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Thu Jul 17, 2008 11:12 am    Post subject: Reply with quote

Ask the moderator for "edit" authorization and he'll probably grant it.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Jul 17, 2008 11:43 am    Post subject: Reply with quote

Eric.C.Bakke,

You can now edit your OWN posts. btw I haven't tested it but does the program support PDSE's?

Thanks
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group