Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
GNP call
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> IMS DB/DC
Author Message
girish_s

New User


Joined: 31 Jul 2007
Posts: 45
Location: india

PostPosted: Tue Dec 04, 2007 12:21 pm    Post subject: GNP call
Reply with quote

hi
i have a situation where i have two segments product and order..
the product segment is the parent of order segment..
The product segment has the following fields
product id
category id
the order segment has the following fields
product id
total cost

now im reading a category id from the file and checking for the corresponding product id in the product segment
im doing this using a gn call

now for that product id i have to fetch the total cost from order segment.
im using a gnp call for this

now my problem is that when im issuing a gnp call and checking for the segment name it is taking product segment rather than order segment

could anyone help me on this please

thanks in advance
girish
Back to top
View user's profile Send private message
References
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 183
Location: Pune

PostPosted: Tue Dec 04, 2007 12:27 pm    Post subject:
Reply with quote

First establish the parentage for the Product segment using a GU call and then use GNP to retreive Order segments.
Back to top
View user's profile Send private message
girish_s

New User


Joined: 31 Jul 2007
Posts: 45
Location: india

PostPosted: Tue Dec 04, 2007 12:46 pm    Post subject:
Reply with quote

thanks for the input srihari
i have established parentage for the product segment but im still getting that error.. the gnp call is not recognising the order segment...
Back to top
View user's profile Send private message
Sandy Zimmer

Senior Member


Joined: 13 Jun 2007
Posts: 435
Location: Wilmington, DE

PostPosted: Tue Dec 04, 2007 5:19 pm    Post subject:
Reply with quote

Please show us your IMS calls.
Back to top
View user's profile Send private message
girish_s

New User


Joined: 31 Jul 2007
Posts: 45
Location: india

PostPosted: Tue Dec 04, 2007 6:22 pm    Post subject: Reply to: GNP call
Reply with quote

gn call for the product segment...
CALL 'CBLTDLI' USING DLI-GN
DB-PCB-MASK
PROD-DB-AREA
PROD-ID-SSA.
01 PROD-ID-SSA.
05 FILLER PIC X(9) VALUE 'PRODUCT ('.
05 FILLER PIC X(10) VALUE 'PRODCAID ='.
05 PROD-CAT-CID PIC X(5).
05 FILLER PIC X VALUE ')'.
gnp call for order segment
CALL 'CBLTDLI' USING DLI-GNP
DB-PCB-MASK
ORDR-DB-AREA
ORDR-ID-SSA.
01 ORDR-ID-SSA.
05 FILLER PIC X(9) VALUE 'ORD ('.
05 FILLER PIC X(10) VALUE 'ORDPID ='.
05 ORDR-PID-VALUE PIC 9(5).
05 FILLER PIC X VALUE ')'.
Back to top
View user's profile Send private message
Sandy Zimmer

Senior Member


Joined: 13 Jun 2007
Posts: 435
Location: Wilmington, DE

PostPosted: Tue Dec 04, 2007 7:05 pm    Post subject:
Reply with quote

Always remember that IMS calls are based on POSITION. You can NEVER go backwards - only forwards. You can re-position yourself with a GU. The first thing I would do is to load your key for the prod segment into the prod-cat-cid. I would then issue a GU - not a GN. Behind the scenes - with a GN - even a qualified, IMS reads each prod segment until it satisfies the loaded key. With a GU, IMS looks at the CI splits to determine where the key may be. (Just in case you wanted to know). I hope you are checking for successful call when you issue the call for the prod. If you don't get it, you should have some sort of error routine for the result of your call depending on what the status code is - anything other the spaces or GE (not found) will be very bad.

gn call for the product segment...

CALL 'CBLTDLI' USING DLI-GN
DB-PCB-MASK
PROD-DB-AREA
PROD-ID-SSA.

01 PROD-ID-SSA.
05 FILLER PIC X(9) VALUE 'PRODUCT ('.
05 FILLER PIC X(10) VALUE 'PRODCAID ='.
05 PROD-CAT-CID PIC X(5).
05 FILLER PIC X VALUE ')'.

Once you have the parent, you will need to retrieve the child - or children. Do you have a key for the order? How do you know which order you are looking for? You cannot issue a qualified call under the root unless you know. You need to explain what you are looking for. It cannot and must not be a qualified call unless you know. Remember that the reason this is a child segment is that there can be 1 to many.

gnp call for order segment

CALL 'CBLTDLI' USING DLI-GNP
DB-PCB-MASK
ORDR-DB-AREA
ORDR-ID-SSA.

01 ORDR-ID-SSA.
05 FILLER PIC X(9) VALUE 'ORD ('. ---------------------------you will need to make this spaces unless you know the order number.....
05 FILLER PIC X(10) VALUE 'ORDPID ='.
05 ORDR-PID-VALUE PIC 9(5).
05 FILLER PIC X VALUE ')'.
Back to top
View user's profile Send private message
girish_s

New User


Joined: 31 Jul 2007
Posts: 45
Location: india

PostPosted: Wed Dec 05, 2007 9:26 am    Post subject:
Reply with quote

hi sandy thanks for the input it was really valuable....
i have given a qualified ssa to the order segment because i want only those product id that are present in the order segment... so the product id im getting from the product segment after the gn call i am using it in the ordr ssa and checking if that product id is also present in the order segment....
hope wat i have used is correct... and any suggestions would be appreciated...

thanks
girish
Back to top
View user's profile Send private message
girish_s

New User


Joined: 31 Jul 2007
Posts: 45
Location: india

PostPosted: Wed Dec 05, 2007 4:16 pm    Post subject:
Reply with quote

i was able to solve that problem...
now another issue is that the gn call for the product segment is not working...
i have given a gn call for the product segment, if this call is successful then i am giving gu call for the product segment to establish parentage for the next gnp call that i have given to the order segment...
after the gnp call is satisfied it goes back to the gn call but its not fetching the next product id...
can someone help

thanks
girish
Back to top
View user's profile Send private message
Sandy Zimmer

Senior Member


Joined: 13 Jun 2007
Posts: 435
Location: Wilmington, DE

PostPosted: Wed Dec 05, 2007 4:21 pm    Post subject:
Reply with quote

Please read again what I said. Do you have a DBD map? Please show it to us. From what you said first, the order is the child of the product. If you can show us the logical view of the database that will help.
Back to top
View user's profile Send private message
girish_s

New User


Joined: 31 Jul 2007
Posts: 45
Location: india

PostPosted: Wed Dec 05, 2007 4:28 pm    Post subject:
Reply with quote

this is my dbd...

SEGM NAME=PRODUCT,PARENT=CUSTOMER,BYTES=82
FIELD NAME=(PRODID,SEQ,U),BYTES=5,START=1,TYPE=P
FIELD NAME=PRODNAME,BYTES=25,START=6,TYPE=C
FIELD NAME=PRODSID,BYTES=5,START=31,TYPE=P
FIELD NAME=PRODCAID,BYTES=5,START=36,TYPE=P
FIELD NAME=PRODCANM,BYTES=25,START=41,TYPE=C
FIELD NAME=PRODUPR,BYTES=7,START=66,TYPE=P
FIELD NAME=PRODUSTK,BYTES=5,START=73,TYPE=P
FIELD NAME=PRODUORD,BYTES=5,START=78,TYPE=P
SEGM NAME=ORD,PARENT=PRODUCT,BYTES=72
FIELD NAME=(ORDID,SEQ,U),BYTES=5,START=1,TYPE=P
FIELD NAME=ORDCID,BYTES=5,START=6,TYPE=P
FIELD NAME=ORDEID,BYTES=5,START=11,TYPE=P
FIELD NAME=ORDPID,BYTES=5,START=16,TYPE=P
FIELD NAME=ORDQTY,BYTES=5,START=21,TYPE=C
FIELD NAME=ORDDT,BYTES=10,START=26,TYPE=C
FIELD NAME=ORDRDT,BYTES=10,START=36,TYPE=C
FIELD NAME=ORDSDT,BYTES=10,START=46,TYPE=C
FIELD NAME=ORDCST,BYTES=5,START=56,TYPE=C
FIELD NAME=ORDTOT,BYTES=12,START=61,TYPE=C
DBDGEN
FINISH
END
Back to top
View user's profile Send private message
Sandy Zimmer

Senior Member


Joined: 13 Jun 2007
Posts: 435
Location: Wilmington, DE

PostPosted: Wed Dec 05, 2007 4:45 pm    Post subject:
Reply with quote

You need to do a GU for the product root - where is the key coming from? It would really help if we knew what you are trying to do. Are you reading ALL the products in the database and then retrieving their child segments? You should not be issuing 2 calls for the product segment. If you will answer these questions, then I will explain the best way to solve your problem.

SEGM NAME=PRODUCT,PARENT=CUSTOMER,BYTES=82 --ROOT
FIELD NAME=(PRODID,SEQ,U),BYTES=5,START=1,TYPE=P key
FIELD NAME=PRODNAME,BYTES=25,START=6,TYPE=C
FIELD NAME=PRODSID,BYTES=5,START=31,TYPE=P
FIELD NAME=PRODCAID,BYTES=5,START=36,TYPE=P
FIELD NAME=PRODCANM,BYTES=25,START=41,TYPE=C
FIELD NAME=PRODUPR,BYTES=7,START=66,TYPE=P
FIELD NAME=PRODUSTK,BYTES=5,START=73,TYPE=P
FIELD NAME=PRODUORD,BYTES=5,START=78,TYPE=P ?????

How are you loading a key for this child segment?

SEGM NAME=ORD,PARENT=PRODUCT,BYTES=72 CHILD of Product
FIELD NAME=(ORDID,SEQ,U),BYTES=5,START=1,TYPE=P key
FIELD NAME=ORDCID,BYTES=5,START=6,TYPE=P
FIELD NAME=ORDEID,BYTES=5,START=11,TYPE=P
FIELD NAME=ORDPID,BYTES=5,START=16,TYPE=P
FIELD NAME=ORDQTY,BYTES=5,START=21,TYPE=C
FIELD NAME=ORDDT,BYTES=10,START=26,TYPE=C
FIELD NAME=ORDRDT,BYTES=10,START=36,TYPE=C
FIELD NAME=ORDSDT,BYTES=10,START=46,TYPE=C
FIELD NAME=ORDCST,BYTES=5,START=56,TYPE=C
FIELD NAME=ORDTOT,BYTES=12,START=61,TYPE=C
Back to top
View user's profile Send private message
girish_s

New User


Joined: 31 Jul 2007
Posts: 45
Location: india

PostPosted: Wed Dec 05, 2007 5:24 pm    Post subject:
Reply with quote

thanks for that input sandy...
i am using the prodcaid as the key to the ssa that i am using for the gn call. now one prodcaid(product category id) can have more than i prodid(product id)... so the first prodid corresponding to the prodcaid is got from the gn call from the product segment....
now i need to check whether this prodid exists in the order segment.. so i am passing this prodid to the ordr ssa and using a gnp call to check if it is present by using ordpid field.. if the call is successfull then i retrieve the corresponding ordtot and print this.....
now after we are done with the first prodid i need to get the second prodid that matches the prodcaid from the product segment... this is not happening...

thanks
girish
Back to top
View user's profile Send private message
Sandy Zimmer

Senior Member


Joined: 13 Jun 2007
Posts: 435
Location: Wilmington, DE

PostPosted: Wed Dec 05, 2007 5:56 pm    Post subject:
Reply with quote

Well, your first problem is that you are using a qualified SSA for both segments. A qualified SSA is used when you already know the key value. Using an unqualified SSA to read sequentially thru the database is the correct avenue.

I am using the prodcaid FIELD NAME=PRODCAID,BYTES=5,START=36,TYPE=P - This field is NOT a key field.

Also, you cannot use a qualified SSA to get the child ORDER segment. There can be several ORDER segments under that product.

So, lets make sure we are on the same page. You need to retrieve all products that have a specific category on their segment - correct?

Then you need to retrieve all order segments beneath that product printing the order totalsthe - correct? You realize that there could be hundreds of order segments beneath that product - correct?
Back to top
View user's profile Send private message
girish_s

New User


Joined: 31 Jul 2007
Posts: 45
Location: india

PostPosted: Wed Dec 05, 2007 6:09 pm    Post subject:
Reply with quote

hi sandy,
your understanding of the problem statement is right... and as you said the procaid is not the key field.. so how do i go about it..
this is where i am stuck...

thanks
girish
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 183
Location: Pune

PostPosted: Wed Dec 05, 2007 6:12 pm    Post subject:
Reply with quote

Girsh.....If I understood your requirement correctly, you can try this out.
1) Issue GU call with unqualified SSA for Product segment
2) check if it contains the Prodcaid, if it presents then do a GNP for Order segment processing.
3) Do a GN to proceed with the next product segment.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> IMS DB/DC All times are GMT + 6 HoursGoto page 1, 2  Next
Page 1 of 2