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 

Accessing IMS DB from CICS, length of PCB ADDRESS LIST

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> IMS
View previous topic :: View next topic  
Author Message
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 314
Topics: 48
Location: germany

PostPosted: Thu Jul 10, 2014 8:35 am    Post subject: Accessing IMS DB from CICS, length of PCB ADDRESS LIST Reply with quote

Hallo *,

to access a IMS DB from CICS transaction I use this data structure

Code:


DCL UIBPTR PTR;                     /* POINTER TO UIB              */
DCL 1 DLIUIB UNALIGNED BASED(UIBPTR),
                                    /* EXTENDED CALL USER INTFC BLK*/
  2 UIBPCBAL PTR,                   /* PCB ADDRESS LIST            */
  2 UIBRCODE,                       /* DL/I RETURN CODES           */
    3 UIBFCTR BIT(8) ALIGNED,       /* RETURN CODES                */
    3 UIBDLTR BIT(8) ALIGNED;       /* ADDITIONAL INFORMATION      */
   


The field UIBPCBAL points to a list of n PCB pointers to access the IMS DB.

If the structure of the PSB ("number of IMS DBs in PSB") is known, i can access the PCB ADDRESS LIST with an index to get the PCB for a specific IMS DB. No problem so far.

But, if my program works with different PSBs, the PCB ADDRESS LIST may have a diffrent length, depending on the PSB (allocated by PLITDL PCB .....).

So question is: How can I obtain the length (number of valid elements) of the PCB ADDRESS LIST to walk though the list and check each PCB if it is the required PCB ?

regards,
bauer
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jul 10, 2014 12:59 pm    Post subject: Reply with quote

bauer,

How are accessing IMS from CICS? via LU or DBCTL?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 314
Topics: 48
Location: germany

PostPosted: Fri Jul 11, 2014 12:44 am    Post subject: Reply with quote

CICS System uses DBCTL
Application program as mentioned above PL!TDLI PCB .....
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jul 11, 2014 12:24 pm    Post subject: Reply with quote

bauer,

Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?p=59160

and chapter 7 from this link

CICS IMS Database Control Guide
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 314
Topics: 48
Location: germany

PostPosted: Mon Jul 14, 2014 2:44 am    Post subject: Reply with quote

kolusu,

thank you for your reply.

Well, I'm not sure, if my question is 100% clear, may be my verbalization was unclear.

So here is some code. This is coded in a CICS PL/1 Transaction.

Code:



   /* -----------------------------------------*/
   /* Deklarations                             */
   /* -----------------------------------------*/

 DCL UIBPTR PTR;                     /* POINTER TO UIB              */
 DCL 1 DLIUIB UNALIGNED BASED(UIBPTR),
                                     /* EXTENDED CALL USER INTFC BLK*/
   2 UIBPCBAL PTR,                   /* PCB ADDRESS LIST            */
   2 UIBRCODE,                       /* DL/I RETURN CODES           */
     3 UIBFCTR BIT(8) ALIGNED,       /* RETURN CODES    @EAPARE @01A*/
     3 UIBDLTR BIT(8) ALIGNED;       /* ADDITIONAL INFORMATION
                                                    *  @EAPARE @01A*/

 DCL  CNTR       BIN FIXED(31) ;
 DCL  FUNC       CHAR     (04) ;
 DCL  PLITDLI    ENTRY         ;

 DCL PSB_NAME CHAR(8)      ;
 DCL PCB_ADDRESS_LIST(256) BASED(DLIUIB.UIBPCBAL) POINTER ;

 DCL I BIN FIXED(31) ;



  /* -----------------------------------------*/
  /* Get PSB                                  */
  /* -----------------------------------------*/
    PSB_NAME = GetPSBName();
    CNTR = 3 ;
    FUNC = 'PCB ';
    CALL PLITDLI(CNTR,FUNC,PSB_NAME,UIBPTR);
    IF UIBFCTR ^= '00000000'B THEN DO;
       PUT SKIP EDIT('ERROR')(A);
       SIGNAL ERROR ;
    END;
    ELSE DO;
    END;


  /* -----------------------------------------*/
  /* Check available PCB's                    */
  /* -----------------------------------------*/
    DO I = 1 TO 256 ;
       /* How many entries are valid ?????*/
       CALL Check(PCB_ADDRESS_LIST(I));
    END;

  /* -----------------------------------------*/
  /* Terminate PSB                            */
  /* -----------------------------------------*/
    CNTR = 1 ;
    FUNC = 'TERM';
    CALL PLITDLI(CNTR,FUNC);




The routine / function GetPSBName just returns the char(8) PSB name.

The routine Check does some checking, reporting or any thing else with each PCB. Here for testings it just prints the database name.

Code:


Check:
   PROC(pPCB) ;

   DCL 1 pPCB PTR ;
   DCL 1 PCB UNAL BASED(pPCB)
         ,2  DBNAME     CHAR     (08)
         ,2  SLEVEL     CHAR     (02)
         ,2  S_CODE     CHAR     (02)
         ,2  OPTION     CHAR     (04)
         ,2  JCBADD     BIN FIXED(31)
         ,2  FBNAME     CHAR     (08)
         ,2  KEYLEN     BIN FIXED(31)
         ,2  SENSEG     BIN FIXED(31)
         ;

   PUT SKIP EDIT(PCB.DBName)(A);

   END;



My problem now is, how many PCBs are available in the PSB? What's the real length of the PCB_ADDRES_LIST ?

When shall I terminate the loop over the PCB_ADDRESS_LIST ?

I cantn't find any hint's in the IBM manuals (and my IMS Coding time is so far ago ........).

If I limit the loop over the PCB_ADDRESS_LIST to to the number of PCBs in the PSB the coding works.

If I do not limit the loop, the result is, that the first valid elements are printed, and then

Code:

DFHAC2236 07/14/2014 09:12:07 CICSTSTM Transaction XXXX abend ASRA in program EQANCXOU term E000. Updates to local recoverable
           resources will be backed out.


(XXXX is my transactioname)

Any comments? Hints?

Kind regards,
bauer
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Jul 14, 2014 5:30 pm    Post subject: Reply with quote

bauer wrote:

Code:

 DCL  CNTR       BIN FIXED(31) ;
 DCL  FUNC       CHAR     (04) ;
 DCL  PLITDLI    ENTRY         ;

 DCL PSB_NAME CHAR(8)      ;
 DCL I BIN FIXED(31) ;


  /* -----------------------------------------*/
  /* Get PSB                                  */
  /* -----------------------------------------*/
    PSB_NAME = GetPSBName();
    CNTR = 3 ;
    FUNC = 'PCB ';
    CALL PLITDLI(CNTR,FUNC,PSB_NAME,UIBPTR);
 




Something doesn't seem right here. Why do you have FUNC = 'PCB' ?

The format of the database call is as follows.

Code:

CALL PLITDLI(num-parms,dli-function, pcb-mask, io-area, ssa, ...)


And the dli-function field can contain any of the following values:
Code:

    GU Get Unique
    GHU Get Hold Unique
    GN Get Next
    GHN Get Hold Next
    GHNP Get Hold Next within Parent
    DLET Delete
    REPL Replace
    ISRT Insert
    FLD Field
    POS Position


Your function code should be GN.

Convert these COBOL definitions to your PLI defintions

Code:

01 AIB-CNTL-BLOCK.                                             
   05 AIBRID             PIC x(8).                             
   05 AIBRLEN            PIC 9(9) USAGE BINARY.               
   05 AIBRSFUNC          PIC x(8).                             
   05 AIBRSNM1           PIC x(8).                             
   05 AIBRSNM2           PIC x(8).                             
   05 AIBRESV1           PIC x(8).                             
   05 AIBOALEN           PIC 9(9) USAGE BINARY.               
   05 AIBOAUSE           PIC 9(9) USAGE BINARY.               
   05 AIBRESV2           PIC x(12).                           
   05 AIBRETRN           PIC 9(9) USAGE BINARY.               
   05 AIBREASN           PIC 9(9) USAGE BINARY.               
   05 AIBERRXT           PIC 9(9) USAGE BINARY.               
   05 AIBRESA1           USAGE POINTER.                       
   05 AIBRESA2           USAGE POINTER.                       
   05 AIBRESA3           USAGE POINTER.                       
   05 AIBRESV4           PIC x(40).                           
   05 AIBRSAVE           OCCURS 18 TIMES USAGE POINTER.       
   05 AIBRTOKN           OCCURS 6 TIMES  USAGE POINTER.       
   05 AIBRTOKC           PIC x(16).                           
   05 AIBRTOKV           PIC x(16).                           
   05 AIBRTOKA           OCCURS 2 TIMES PIC 9(9) USAGE BINARY.       
                                                                     
01 IMS-FUNC-CALLS.                                                   
   05 FUNC-GU            PIC X(04) VALUE 'GU  '.                       
   05 FUNC-GN            PIC X(04) VALUE 'GN  '.                       
   05 FUNC-CHNG          PIC X(04) VALUE 'CHNG'.                     
   05 FUNC-ISRT          PIC X(04) VALUE 'ISRT'.                     
   05 FUNC-PURG          PIC X(04) VALUE 'PURG'.                     
   05 FUNC-INQY          PIC X(4)  VALUE 'INQY'.                     
                                                                     
01 IMS-IO-AREA           PIC X(100).                       


and then use this code
Code:

AIBRSNM1 = GetPSBName();
AIBLEN = 264;
CNTR = 4;
FUNC = 'GN  ';

CALL PLITDLI(CNTR,FUNC,AIB-CNTL-BLOCK,IMS-IO-AREA);
IF AIBRETRN ^= '00000000'B THEN DO;
   PUT SKIP EDIT('ERROR')(A);
       SIGNAL ERROR ;
    END;
ELSE DO;
    print the contents of IMS-IO-AREA;
    END;


Now you check the return code from the call and then contents of IMS-IO-AREA and print out the contents
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 314
Topics: 48
Location: germany

PostPosted: Tue Jul 15, 2014 2:58 am    Post subject: Reply with quote

kolusu,

thank you for spending so much of your time.

But I'm sorry, the meaning of the PCB function and problem seems not to be clear to you.

According the PCB function which I pass to the PL1TDLI function (in COBOL CBLTDLI) I just follow the instructions for example here

http://pic.dhe.ibm.com/infocenter/eiic/v1r1/index.jsp?topic=%2Fcom.ibm.ims10.doc.apg%2Fp3hsp.htm

or pls. see here:

CICS Transaction Server for z/OS
Version 4 Release 2
Application Programming Guide, SC34-7158-02, Chapter 3, figure 1, page 28.

The PCB Call is used to schedule, allocate the PSB.

The IBM wording is "Using the DL/I CALL interface" for this technique.

In the mentioned manuals is explained, that after the PCB call is issued, the datastructure PCB_ADDRESS_LIST, see Cobol sample in SC34-7158-02, is available, filled. Afterwards you can obtain the PCB Pointer (IMS DB pointer) from this data structure. Now you can issue IMS DB Call for example GU, GN, REPL .....

What do you meen with your prior question: "How are accessing IMS from CICS? via LU or DBCTL" ?

In my CICS region I can see the messages

DFHSI8440I XXXXXXXX Initiating connection to DBCTL.
DFHSI8441I XXXXXXXX Connection to DBCTL YYYYYYYY successfully completed.

with XXXXXXXX = Name of my CICS region
YYYYYYYY = name of my IMS region.

If I use a pointer from the PCB_ADDRESS_LIST structure, I can access the IMS DB with GU, GN or what else. This works. No problem.

The only problem is:

If the organization of the PSB is know (which database is at which position) I can use index 1, 2, ...n to access the PCB_ADDRESS_LIST (as done in the IBM sample in SC34-7158-02).

If the organization of the PSB is NOT know (this is my situation, CICS program works with different PSBs), I want to check the PCB_ADDRESS_LIST structure to get the correct pointer to access the IMS DB. So I need to know, how many elements in the PCB_ADDRESS_LIST are valid (are valid PCB IMS DB pointers).

I hope, I was able now, to give a exact explaination of the problem Very Happy Very Happy Very Happy

kind regards,
bauer
Back to top
View user's profile Send private message
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 314
Topics: 48
Location: germany

PostPosted: Wed Jul 16, 2014 10:19 am    Post subject: Reply with quote

Hi *,

I have a solution now.

Code:


/* -----------------------------------------*/
/* Check available PCB's                    */
/* -----------------------------------------*/
  /* HIGH END BIT is set in address of last PCB
     in the PCB_ADDRESS_LIST,
     so exit loop if HIGH END BIT is set
     and this entry is processed */
  DCL LAST_PCB BIN FIXED(31) BASED;
  DO I = 1 TO 256 UNTIL(ADDR(PCB_ADDRESS_LIST(I)) -> LAST_PCB < 0);
     CALL Check(PCB_ADDRESS_LIST(I));
  END;




But I can not provide any reference to any IBM manual. The solution I found in discussion with a collegue.

kind regards
bauer
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> IMS All times are GMT - 5 Hours
Page 1 of 1

 
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