Query on insertion of records in in a DBD



IBM's hierarchical database management system with a Database Manager (IMS DB) and a Transaction Manager(IMS DC)

Re: Query on insertion of records in in a DBD

Postby Sandy Zimmer » Mon Nov 24, 2008 12:29 am

I need to see your input file layout. You are showing the segment layout. Why are you determining your logic on the record count?
Sandy Zimmer
 
Posts: 28
Joined: Mon Jul 30, 2007 8:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Query on insertion of records in in a DBD

Postby Sandy Zimmer » Mon Nov 24, 2008 12:30 am

OH - another thing - why are you using indexing to accumulate count?
Sandy Zimmer
 
Posts: 28
Joined: Mon Jul 30, 2007 8:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Query on insertion of records in in a DBD

Postby er.manishawasthi » Mon Nov 24, 2008 5:54 pm

My Input file layout has been changed ........ i will get back to you with new input file layout and a new code to check................
er.manishawasthi
 
Posts: 30
Joined: Sun Jun 29, 2008 7:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Query on insertion of records in in a DBD

Postby er.manishawasthi » Mon Nov 24, 2008 6:20 pm

My input file file layout....

Is First 8 Bytes for segment Name( Arrivals 0r Departs ) ,Then next 25 bytes have been allocated to key( which includes 4 bytes for key of Root segment which is Airport , next 2 bytes for key of Airline Segment, next 12 bytes contains the key of the segment to be inserted( Arrival Key or Depart Key next 7 bytes is spaces ) then i have the record to be inserted ...including key .....

i give u one example......

ARRIVALSIGI SJSJ16.00AMIST SJ16.00AMIST8.00AMISTPUNES1
<---------><-><><--------------><---><----arrivals record includingkey>
| | | | |
8 bytes of | | | |
segment | | | spaces
Name | | 12 bytes key
| | of arrival.
|2 Bytes key
|of airline segment
4 bytes
key of
Airport Key.
You do not have the required permissions to view the files attached to this post.
er.manishawasthi
 
Posts: 30
Joined: Sun Jun 29, 2008 7:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Query on insertion of records in in a DBD

Postby er.manishawasthi » Mon Nov 24, 2008 6:24 pm

code is ....................
You do not have the required permissions to view the files attached to this post.
er.manishawasthi
 
Posts: 30
Joined: Sun Jun 29, 2008 7:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Query on insertion of records in in a DBD

Postby Sandy Zimmer » Mon Nov 24, 2008 6:35 pm

Is this the FINAL input file layout?

Hmmm - well, you need an external sort of your input file prior to your insert program. Sort on airport - airline - then whatever designates arrival/depart - arrival key - depart key. The logic being that if you are positioned on a particular airline/airport in your database, then will not need to issue another "GET" to insert the next record - you are already positioned where you should be. Remember that IMS is positional and to be efficient, think about making your program as efficient as possible.

Set up a couple of areas in working storage called WS-CURR-Key and WS-PREV-Key. Initialize both to spaces - that way you know that you are at the beginning of the file - on your first read, move the key values of your input record to both. On your next input file read, move only to WS-CURR and then compare to WS-PREV. If they are equal, then you do not issue your "GET" on the database - you are correctly positioned.
Sandy Zimmer
 
Posts: 28
Joined: Mon Jul 30, 2007 8:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Query on insertion of records in in a DBD

Postby er.manishawasthi » Mon Nov 24, 2008 8:33 pm

Can u elaborate it a bit more............

just to let u know now i have only records for arrival and departs in my input file..............

I'm not clear what u want to say.................
er.manishawasthi
 
Posts: 30
Joined: Sun Jun 29, 2008 7:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Query on insertion of records in in a DBD

Postby Sandy Zimmer » Tue Nov 25, 2008 7:01 pm

You will also define 2 areas in working storage called ws-curr-key and ws-prev-key. These will be group items containing the key values.

READ FILE-INPUT INTO WS-REC -----> please define ws-rec in working storage
AT END
MOVE 'Y' TO END-INPUT-FILE
GO TO 3000-EXIT.

MOVE WS-REC(9:4) TO ws-curr-airport
MOVE WS-REC(13:2) TO ws-curr- airline

if ws-prev-key = spaces - (this will be spaces on your first read)
move ws-curr-key
to ws-prev-key
PERFORM 3200-HOLD-PARA
THRU 3200-EXIT
else
if ws-prev-key = ws-curr-key
end-if
move ws-curr-key
to ws-prev-key
PERFORM 3200-HOLD-PARA
THRU 3200-EXIT
end-if.

IF WS-REC(1:8) = 'ARRIVALS'
MOVE WS-REC(9:4) TO KEY-VALUE
MOVE WS-REC(13:2) TO KEY-VALUE1
MOVE WS-REC(34:29) TO WS-IO-AREA
MOVE 'ARRIVALS' TO SEGMENT1
PERFORM 3300-INSERT-PARA
THRU 3300-EXIT
ELSE
IF WS-REC(1:8) = 'DEPARTS '
MOVE WS-REC(9:4) TO KEY-VALUE
MOVE WS-REC(13:2) TO KEY-VALUE1
MOVE WS-REC(34:32) TO WS-IO-AREA
MOVE 'DEPARTS ' TO SEGMENT1
PERFORM 3300-INSERT-PARA
THRU 3300-EXIT
END-IF
END-IF.
3000-EXIT. EXIT.

Does this help? I will be out for a little while this morning. Tell me if I made a mistake. Don't forget to think about displaying which segment you did not get when you get a "GE".
Sandy Zimmer
 
Posts: 28
Joined: Mon Jul 30, 2007 8:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Query on insertion of records in in a DBD

Postby er.manishawasthi » Wed Nov 26, 2008 2:06 pm

I got it.......... Thank you very much....................
er.manishawasthi
 
Posts: 30
Joined: Sun Jun 29, 2008 7:36 pm
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to IMS DB/DC

 


  • Related topics
    Replies
    Views
    Last post