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
 

 

Fetching records from a segment
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> IMS DB/DC
View previous topic :: :: View next topic  
Author Message
alamelu1984

New User


Joined: 20 Apr 2007
Posts: 40
Location: bangalore

PostPosted: Tue Aug 07, 2007 12:20 pm    Post subject: Fetching records from a segment
Reply with quote

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
View user's profile Send private message

Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Tue Aug 07, 2007 7:08 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Tue Aug 07, 2007 8:18 pm    Post subject:
Reply with quote

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
View user's profile Send private message
alamelu1984

New User


Joined: 20 Apr 2007
Posts: 40
Location: bangalore

PostPosted: Thu Aug 09, 2007 12:09 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Thu Aug 09, 2007 4:38 pm    Post subject:
Reply with quote

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
View user's profile Send private message
alamelu1984

New User


Joined: 20 Apr 2007
Posts: 40
Location: bangalore

PostPosted: Thu Aug 09, 2007 5:01 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Thu Aug 09, 2007 7:00 pm    Post subject:
Reply with quote

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
View user's profile Send private message
alamelu1984

New User


Joined: 20 Apr 2007
Posts: 40
Location: bangalore

PostPosted: Fri Aug 10, 2007 9:53 am    Post subject:
Reply with quote

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
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Fri Aug 10, 2007 10:48 am    Post subject:
Reply with quote

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
View user's profile Send private message
alamelu1984

New User


Joined: 20 Apr 2007
Posts: 40
Location: bangalore

PostPosted: Fri Aug 10, 2007 11:07 am    Post subject:
Reply with quote

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
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Fri Aug 10, 2007 11:44 am    Post subject:
Reply with quote

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
View user's profile Send private message
alamelu1984

New User


Joined: 20 Apr 2007
Posts: 40
Location: bangalore

PostPosted: Fri Aug 10, 2007 12:11 pm    Post subject:
Reply with quote

hi devzee..
thank yu icon_smile.gif
that solved my problem.. icon_smile.gif

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
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Fri Aug 10, 2007 4:28 pm    Post subject:
Reply with quote

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
View user's profile Send private message
alamelu1984

New User


Joined: 20 Apr 2007
Posts: 40
Location: bangalore

PostPosted: Fri Aug 10, 2007 4:33 pm    Post subject:
Reply with quote

hi sandy, icon_smile.gif

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... icon_confused.gif
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Fri Aug 10, 2007 4:41 pm    Post subject:
Reply with quote

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
View user's profile Send private message
alamelu1984

New User


Joined: 20 Apr 2007
Posts: 40
Location: bangalore

PostPosted: Fri Aug 10, 2007 4:53 pm    Post subject:
Reply with quote

hey sandy.. icon_smile.gif
very good morning... icon_smile.gif
thanx for the corrections icon_biggrin.gif

icon_idea.gif 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
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Fri Aug 10, 2007 4:57 pm    Post subject:
Reply with quote

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
View user's profile Send private message
alamelu1984

New User


Joined: 20 Apr 2007
Posts: 40
Location: bangalore

PostPosted: Fri Aug 10, 2007 5:04 pm    Post subject:
Reply with quote

we are strictly using transaction processing..

hmmmm....ok..will try that..

thank you icon_smile.gif
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Fri Aug 10, 2007 5:14 pm    Post subject:
Reply with quote

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
View user's profile Send private message
alamelu1984

New User


Joined: 20 Apr 2007
Posts: 40
Location: bangalore

PostPosted: Fri Aug 10, 2007 5:20 pm    Post subject:
Reply with quote

thanx so much sandy for all ur inputs.. icon_smile.gif
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 -> IMS DB/DC All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 5 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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