Joined: 02 Dec 2002 Posts: 624 Topics: 175 Location: Stockholm, Sweden
Posted: Fri Jun 01, 2018 3:48 am Post subject: Command codes A and G
Am trying to figure out whether what I'm trying to do isn't possible, or whether I'm doing something wrong.
First of all, the database defition for the relevant situation:-
so, from what I understand, segment SDC16PA isn't sorted.
Okay, to my code. My SSA is defined as:-
Code:
01 ddc16-ssa.
05 filler pic x(8) value 'SDC16PA'.
05 ddc16-command-code pic x(4) value '*---'.
88 ddc16-a value '*A '.
88 ddc16-g value '*G '.
05 filler pic x value '('.
05 filler pic x(8) value 'PA-NYCK'.
05 filler pic xx value '> '.
05 ddc16-start-key pic x(20) value ' '.
05 filler pic x value '&'.
05 filler pic x(8) value 'PA-NYCK'.
05 filler pic xx value '< '.
05 ddc16-end-key pic x(20) value ' '.
05 filler pic x value ')'.
and my first access of the database is (basically, I only want segments starting with PAC)
Code:
move low-value to ddc16-start-key
move 'PAC' to ddc16-start-key(1:3)
*
move high-value to ddc16-end-key
move 'PAC' to ddc16-end-key(1:3)
*
set ddc16-a to true
perform s01-gn-sdc16pa-cbltdli
and the actual CBLTDLI call is
Code:
S01-GN-SDC16PA-cbltdli SECTION.
*
move k-gn to w-ims-call
*
call 'CBLTDLI' using w-ims-call
pcbname
SDC16PA
ddc16-ssa
Now, the first time through (with command code '*A' I get PACVOLEO in my i/o area, basically, what I'd expect).
However, my next call is
Code:
set ddc16-g to true
perform s01-gn-sdc16pa-cbltdli
.
and this returns PPC3009 (which I when I run through the database using "ordinary" GN calls is the next segment returned).
So, based on the documentation for command code G
Quote:
You can use the G command code to indicate to IMS to skip randomization or the calling of the partition selection exit and search the database sequentially. While this command code can be used with other database types, it will affect the access of only HDAM/PHDAM, DEDB, and PHIDAM databases.
So, there are two ways of interpreting this (to my mind).
1 Command code G acts exactly the same way as any ordinary GN and ignores the SSA passsed in.
2 Command code should work, but I'm doing something wrong. I tried changing the second call above to
Code:
set ddc16-g to true
move 'PACVOLEO' to ddc16-start-key
perform s01-gn-sdc16pa-cbltdli
.
but that still returned PPC3009 (which in retrospect is correct based on option 1 above)
Is there a way to do what I'm trying to do? _________________ Michael
Joined: 02 Dec 2002 Posts: 624 Topics: 175 Location: Stockholm, Sweden
Posted: Fri Jun 15, 2018 3:16 am Post subject:
A colleague at work asked an IMS guru friend, and this was the answer given.
A search like that with a HDAM database isn't doable.
The search stops as soon as it finds ANY record greater than PAC, PAD, RAK or whatever.
If you don't have a complete key (which I obviously didn't) then you're forced to read the whole database.
Remember that HDAM is stored based on (your) randomizer. This can result in keys being stored as "Mickly Mouse", then "Donald Duck" etc etc. and that is what GN fetches/finds.
I think I got the translation reasonably correct from Swedish. _________________ Michael
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum