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?
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
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
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
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]
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..