View previous topic :: View next topic
|
Author |
Message |
alamelu1984
New User
Joined: 20 Apr 2007 Posts: 40 Location: bangalore
|
|
|
|
Hi all,
In my application..the hierarchy is like this:
CUSTOMER SEGMENT----> ROOT
EMPLOYEE AND PRODUCT SEGMENTS ------> CHILDREN OF CUSTOMER SEGMENT.
ORDER SEGMENT-----> CHILD OF PRODUCT SEGMENT.
now if i have to fetch a few records from CUSTOMER SEGMENT corresponding to a CUSTOMER-ID-NUMBER,how would i do it??
also to fetch EMPLOYEE records from the EMPLOYEE SEGMENT corresponding to an EMPLOYEE-ID-NUMBER,how wud i do it?
also after a DL/I call, to reset the position to the start of the database,how wud i do it??
regards
aalu |
|
Back to top |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
Use Qualified SSA or path call to retrieve whatever segment you need.
Quote: |
to reset the position to the start of the database,how wud i do it?? |
This may or may not be required depending on what was your prev DLI call, and how your root segment is defined. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
A GU call without absolutely no SSAs will always position you at the beginning of a database.
A segment is a record.....you probably meant to say field?
customer root (level 1)
employee (level 2 child of cust) product (level 2 child of cust)
order (level 3 child of product)
It always important to know what you are tyring to accomplish with your process. To retreive customer root with the customer id, you must have access to the customer id. You then load your customer SSA with that key value and issue a qualified GU. I am not sure if you are looking for an employee associated with a particular customer or the customer does not matter. These would be coded differently - but you can issue qualified GN on the employee segment without knowing the customer. Do the logical and physical DBDs match? |
|
Back to top |
|
|
alamelu1984
New User
Joined: 20 Apr 2007 Posts: 40 Location: bangalore
|
|
|
|
hi all,
thank you sandy and devzee for ur inputs..
ya the physical and logical databases do match..
now if i have to fetch different instances of the customer segement(say all those instances corresponding to a particular customer id number),then can i issue a qualified gu call to the customer segment and then use an unqualified GN call to retrieve those instances????
if NO,then how wud i retrieve those instances of the customer segment.
plzz do explain with an example..
regards
aalu |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
A key value must be unique. You will only have 1 unique segment per key. Is there another field that makes up the customer number? What exactly do you need to look for? Give us the key fields of the customer and the child segments. |
|
Back to top |
|
|
alamelu1984
New User
Joined: 20 Apr 2007 Posts: 40 Location: bangalore
|
|
|
|
hi sandyZ,
Yeah all key values corresponding to a segment are unique..
and customer-number is just one field..
i need to retrieve all instances from the customer segment that coresspond to a particular customer-id (say customer-id-number = 11111)
how wud i do it???
Also,here...after having been able to retrieve customer segment instances corresponding to a customer-id,if i have to do another transaction which requires me to only retrieve instances of the employee segment corresponding to a particular unique employee-id,then how wud i do it..
plzz explain both these with suitable examples..
and below here i have listed out the fields in every segment
Segment = customer,parent=0
customer-id ----------------->> unique key
customer-name
customer-address
customer-city
customer-state
customer-pincode
customer-country
customer-phone
customer-fax
Segment = employee,parent=customer
employee-id--------------------->>>>>>unique key
employee-name
employee-dateofbirth
employee-hiredate
employee-address
employee-city
employee-state
employee-pincode
employee-country
employee-phone
employee-fax
Segment = product, parent=customer
product-id------------------->>>>> unique key
product-name
product-supplier-id
product-category-id
product-unit-price
product-units-in-order
product-units-in-stock
Segment = order,parent=product
order-id---------------------------->>>unique key
order-customer-id
order-product-id
order-employee-id
order-qty
order-date
order-reqd-date
order-shipment-date
order-carrier-cost
order-total-cost |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
So, are you saying that you need to retrieve a particular customer root segment and all of it's children? What are you doing with all of these segments once retrieved?
You must realize that an employee within a particular customer will not be unique, but there could be many employee segments in the database. For instance, I have customer 11111 - under that root, I will have employee 55555. Then I have unique customer 22222 - I can also have employee 55555 beneath this customer.
I would do it in the most efficient manner possible. In order to explain how, I need to know the WHY - what are you trying to achieve? There are always multiple ways to accomplish something based on the requirement. |
|
Back to top |
|
|
alamelu1984
New User
Joined: 20 Apr 2007 Posts: 40 Location: bangalore
|
|
|
|
hi sandy,
here they are separate transactions..
they arent related at all...
in transaction 1:
i need to retrieve instances of the customer segment corresponding to a unique customer id...
ie... after a user keys in the custromer id (say 11111), all instances corresponding to that id have to be fetched..and i am to display all this on my screen...
after this i get back to the main screen and decide to do a transaction 2 where:
the user (ie. me) keys in a unique employee-id and hence is supposed to retrieve all those instances of the employee segment corresponding to the employee id just keyed in...
ps: i am not trying to combine the customer-id and employee-id for any of the transactions here..
they are totally different problem statements...
considering these 2 as totally separate problem stmts,how wud i accomplish them..(with eg)..??? |
|
Back to top |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
I think 2 calls will do
1. GU call for Emp segment - Qual SSA for Cust, Unqual SSA for Emp
2. GU call for Prod segment - Qual SSA for Cust, Unqual SSA for Prod
3. GU call for Order segment - Qual SSA for Cust, Unqual SSA for Prod, Unqual SSA for Order
Above is based on assumption that EMP, Prod and Order segments has only one segment occurance for each customer |
|
Back to top |
|
|
alamelu1984
New User
Joined: 20 Apr 2007 Posts: 40 Location: bangalore
|
|
|
|
hi devzee,
thanx for ur input..
if i use a GU call to set the database position to point to the customer segment (which is the root)..
then which call stmt do i use to retreive the all occurences only from customer (ie.root) segment... |
|
Back to top |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
Quote: |
all occurences only from customer (ie.root) segment |
After setting the position you can do GN using CUST SSA to read all occurances from customer seg |
|
Back to top |
|
|
alamelu1984
New User
Joined: 20 Apr 2007 Posts: 40 Location: bangalore
|
|
|
|
hi devzee..
thank yu
that solved my problem..
and one more thing..
considering the same scenario where..
customer (root)
employee(child of customer) product(child of customer)
order(child of product)
now,if i maybe issue a GU call to set the database position to the root (ie.the customer segment) ,then wat DL/I call stmt shud i use to get all segment occurences of "only" the employee segment... |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
There can be only 1 customer root - the reason that the product and order are children is because they can be 1 to many.
1. GU call for Emp segment - Qual SSA for Cust, Unqual SSA for Emp
2. Perfrom a routine that will GN call for Prod segment - Qual SSA for Cust, Unqual SSA for Prod - until no more Product segments for that customer - could be 1 - could be many
3. Perform a routine that will GN call for Order segment - Qual SSA for Cust, Unqual SSA for Prod, Unqual SSA for Order - until no more Order segments for that customer - could be 1 - could be many
Another thing you may want to consider is the possibility of mulitple screens. It is always a good idea to plan for the worst case scenario. What if you have 150 products under that customer and only have room on your screen for 100? |
|
Back to top |
|
|
alamelu1984
New User
Joined: 20 Apr 2007 Posts: 40 Location: bangalore
|
|
|
|
hi sandy,
thanx for the input..
yeah rite..in case of wanting to display all the 150 records i`l have to use paging rite???
wat kind of paging will i have to use?? physical or logical...really confused there... |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
Whoops - number 1 should be GU for customer with just Cust qualified SSA - no coffee yet - early morning here.
1. GU call for Emp segment - Qual SSA for Cust
1.1. Perfrom a routine that will GN call for Emp segment - Qual SSA for Cust, Unqual SSA for Emp- until no more Employee segments for that customer - could be 1 - could be many
1.2. Perfrom a routine that will GN call for Prod segment - Qual SSA for Cust, Unqual SSA for Prod - until no more Product segments for that customer - could be 1 - could be many
1.2. 3. For each Product retrieved Perform a routine that will GN call for Order segment - Qual SSA for Cust, Qual SSA for Prod, Unqual SSA for Order - until no more Order segments for that product - could be 1 - could be many |
|
Back to top |
|
|
alamelu1984
New User
Joined: 20 Apr 2007 Posts: 40 Location: bangalore
|
|
|
|
hey sandy..
very good morning...
thanx for the corrections
but then...if i have to fetch all the employee segment occurences , isnt it enuf for me to set the database position using a GU call without any SSAs and then later issue a GN call with an unqualified customer SSA and a qualified Employee SSA..?????? (plzz correct me if i am wrong) |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
Well, it depends on your installation standards. Do you use SPA area or are you strictly transaction processing?
Get the first part coded and tested and if you have more segments than room on your screen, just pretend you didn't - for now. In other words, put a counter in your logic for the array on your screen - limit. |
|
Back to top |
|
|
alamelu1984
New User
Joined: 20 Apr 2007 Posts: 40 Location: bangalore
|
|
|
|
we are strictly using transaction processing..
hmmmm....ok..will try that..
thank you |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
Can we make sure that we are talking about EACH situation?
Let's label them scenario 1 and scenario 2.
In Problem 1, I think we have that going....
Problem 2, you just want to go after certain employee numbers - correct?
You can load a qualified employee SSA and issue a GN against that segment until GE or GB. Again, the result may be hundreds - so you need to plan for that.
Perfrom a routine that will GN call for Emp segment - Qual SSA for EMP, until no more Employee segments for that number - could be 1 - could be many
You can then take a look at the key feedback area to see which customer number is related to that employee. Remember that internally IMS has pointers so that you can always find out the key value above the segment you are retrieving. |
|
Back to top |
|
|
alamelu1984
New User
Joined: 20 Apr 2007 Posts: 40 Location: bangalore
|
|
|
|
thanx so much sandy for all ur inputs.. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
If you are using strictly transaction processing, once you send your first screen and come back into your program, anything you saved in your work areas is gone. The way that I always did it was hidden fields on the screen to let me know exactly where I was when I sent out that last message to the que. I would put those fields at the beginning of your message so that the message length will be shorter - and thus more efficient. |
|
Back to top |
|
|
alamelu1984
New User
Joined: 20 Apr 2007 Posts: 40 Location: bangalore
|
|
|
|
hi sandy,
i am not sure i got u there...
could u plzz elaborate on it and explain.. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
I am assuming that you mean coming back into your program? If so, when you do your get for your message, you will put code right after that for your multiple screen processing. You would not be doing anything differently than check your hidden areas on that screen for screen number and the key values in the data base where you were when you sent out your last screen. It is not as difficult as you may imagine.
It is 6:45am Monday morning here - I need some tea. Think this over. As I said before, get the first part working. |
|
Back to top |
|
|
alamelu1984
New User
Joined: 20 Apr 2007 Posts: 40 Location: bangalore
|
|
|
|
hi sandy,
thanx so much for ur inputs..
like u said,i`l get the first part up and running..
and then will think about the rest... |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
Nothing is too difficult if you do it in steps. |
|
Back to top |
|
|
|