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
 

 

Retrieving only one side of hierarchy

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> IMS DB/DC
View previous topic :: :: View next topic  
Author Message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Tue Dec 16, 2008 11:54 am    Post subject: Retrieving only one side of hierarchy
Reply with quote

Hi,

I have a Hospital database whose DBD is below.

DBD NAME=HOSPLDBD,ACCESS=(HDAM,VSAM),
RMNAME=(DFSHDC40,010,00000120,00004096)
DATASET DD1=HOSPDD,DEVICE=3390,SIZE=4096
SEGM NAME=PATIENT,BYTES=45,PARENT=0
FIELD NAME=(PATNO,SEQ,U),BYTES=5,START=01,TYPE=C
FIELD NAME=(PATNAME),BYTES=10,START=06,TYPE=C
FIELD NAME=(PADDR),BYTES=30,START=16,TYPE=C
SEGM NAME=ILLNESS,BYTES=18,PARENT=PATIENT
FIELD NAME=(ILLDATE,SEQ),BYTES=8,START=01,TYPE=C
FIELD NAME=ILLNAME,BYTES=10,START=09,TYPE=C
SEGM NAME=TREATMNT,BYTES=32,PARENT=ILLNESS
FIELD NAME=(TRDATE,SEQ),BYTES=8,START=01,TYPE=C
FIELD NAME=MEDICINE,BYTES=10,START=09,TYPE=C
FIELD NAME=QTY,BYTES=4,START=19,TYPE=C
FIELD NAME=DOCTOR,BYTES=10,START=23,TYPE=C
SEGM NAME=BILLING,BYTES=06,PARENT=PATIENT
FIELD NAME=BILLING,BYTES=06,START=01,TYPE=C
SEGM NAME=PAYMENT,BYTES=06,PARENT=BILLING
FIELD NAME=PAYMENT,BYTES=06,START=01,TYPE=C
SEGM NAME=HOUSHOLD,BYTES=18,PARENT=PATIENT
FIELD NAME=(RELNAME,SEQ),BYTES=10,START=01,TYPE=C
FIELD NAME=RELATION,BYTES=08,START=10,TYPE=C
DBDGEN
FINISH
END

My requirement is to retrieve only one side of hierarchy i.e. I want to retrieve all the ILLNESS & TREATMNT segments for one particular patient. I don't want BILLING, PAYMENT & HOUSHOLD segments.

I am a beginner to IMS, could you please help with above?
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 Dec 16, 2008 9:02 pm    Post subject:
Reply with quote

It's very easy. Do you want every patient in the database?
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 Dec 16, 2008 9:25 pm    Post subject:
Reply with quote

I'll assume you want every patient. Perform loop 1 until done.

loop 1 (patient) - unqualified gn ssa until end of database
load patient key into qualified ssa

perform loop 2a until done
perform loop 2b until done

loop 2a (illness) - use qualified patient ssa and unqualified illness ssa to
retrieve all illness segments under this patient until GE or GB

loop 2b (treatment) - use qualified patient ssa and unqualified
treatment ssa to retrieve all treatment
segments under this patient segment until GE or GB
Back to top
View user's profile Send private message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Wed Dec 17, 2008 5:38 pm    Post subject:
Reply with quote

Hi Sandy,

I need all ILLNESS & TREATMNT segment occurrences for only one PATIENT.

Logic I implemented is:

STEP1 : GU for a particular PATIENT
STEP2 : Loop1 - GN with PATIENT qualified SSA, ILLNESS unqualified SSA.
STEP3 : Loop2(within Loop1) - GN with PATIENT qualified SSA, ILLNESS unqualified SSA, TREATMNT unqualifed SSA until GE/GB.

But I got only patient, first illness occurrence and all treatmnt occurrences. I am not getting remaining illness occurrences.

Please help.
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


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

PostPosted: Wed Dec 17, 2008 6:03 pm    Post subject:
Reply with quote

STEP2 : Loop1 - GN with PATIENT qualified SSA, ILLNESS unqualified SSA.

You need to add until GE/GB logic to loop1.

STEP3 : Loop2(within Loop1) - GN with PATIENT qualified SSA, ILLNESS unqualified SSA, TREATMNT unqualifed SSA until GE/GB.

Treatment is a child of illness - once you have an illness segment, you need to load a fully qualified ssa for that illness segment.

Perhaps you will only have 1 illness segment - or perhaps you won't have any. Always code for every possible agenda.

Why are you using GU on the patient segment? Do you already have the key? The reason you are only getting the first patient is because you are using a GU. A get unique - with or without a fully qualified ssa - will always position you on the first segment in the database on your first call.

You need to use 'loop" logic for the patient segment with a GN if you want more than just the first patient segment. Also, don't forget GB logic there.
Once you have a patient segment, then load the key of that patient into a qualified SSA for your loop1[/i]
Back to top
View user's profile Send private message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Thu Dec 18, 2008 12:42 pm    Post subject:
Reply with quote

I gave GU because i want to display Patient segment as well. Yes i had the key and i am looking for all the Illness and Treatment segment occurrences under the above Patient. And also i have 2 Illness segment occurrences under this Patient.

Quote:


Treatment is a child of illness - once you have an illness segment, you need to load a fully qualified ssa for that illness segment


Hello,

Now i understood that i need to qualify Illness before retrieving Treatmnt segment occurrences. Here is where i went wrong and got only first Illness and not the second one since i was using unqualified Illness SSA in loop2.
Now i got what i needed. Many thanks..
Back to top
View user's profile Send private message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Thu Dec 18, 2008 1:54 pm    Post subject:
Reply with quote

Hi Sandy,

Many thanks for your help.
Is there any way i can achieve the above requirement using Command Codes?

Please advise.
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 Dec 18, 2008 5:02 pm    Post subject:
Reply with quote

Why do you want to use command codes if you don't need them? And, the answer to your question is no.
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Generate - Hierarchy of the Outpu... GAPX1 COBOL Programming 1 Tue Jul 28, 2015 2:13 am
No new posts Syncsort - put strings side by side ramas.kamal SYNCSORT 4 Wed May 21, 2014 4:22 pm
No new posts Retrieving unique occurance Shweta12j DB2 7 Thu Aug 08, 2013 7:57 pm
No new posts Retrieving User ID and Cics region ID dudenithy CICS 6 Tue Jul 09, 2013 9:02 pm
No new posts XRC side effect On Primary site. Manshadi JCL & VSAM 2 Wed Feb 27, 2013 5:31 pm


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