View previous topic :: View next topic
|
Author |
Message |
saranyasakthivel
New User
Joined: 08 Jan 2015 Posts: 4 Location: India
|
|
|
|
Hi,
I am trying to update the Assembler Table in my application. Initial size of the table was about 5K entries as per business request I updated the entries and now the table has 11K entries.
I have sucessfully updated the table and complied the code. But the new table is not picked correctly in the calling module. I doubt if there is some problem with the address constants
compiler options:
Code: |
MODE AMODE(31) RMODE(ANY)
|
Assembler Table is loaded as a vector to the R0 register and the program SRCH_PGM(Binary Search Assembler Program) is used to lookup the assembler table.
Below is the snippet of the code,Can someone help me, in resolving this issue.
calling module:
Code: |
LA R1,ARG
L R0,=V(TABLE)
CALL SRCH_PGM
LTR R1,R1
|
SRCH_PGM is a generic program which can be used to search the tables with maximum size of 100K entries.
Assembler Table:
Code: |
TABLE CSECT
DC AL4(TOP2LTB) ADDRESS TOP 2
DC AL4(MID1LTB) ADDRESS MID 1
DC AL4(MID2LTB) ADDRESS MID 2
DC A(32767) NMBR IN TAB 1
DC A(32767) NMBR IN TAB 2
DC A(06009) NUMB OF TOP 2
DC A(08837) NUMB OF MID 2
DC A(03423) NUMB OF MID 1
DC A(TOPLTB)
DC A(DNMTTLTB)
DC A(NUMLTB)
DC AL1(00)
DC AL1(51) LEN ARGUMENT
DC AL1(53) LEN ENTRY
DC AL1(00) LEN FUNCTION
NUMLTB DC A((ENDLTB-TOPLTB)/53)
TOPLTB EQU *
DC C'AAAAA'
DC C'BBBBB'
DC C'CCCC'
.
.
MID1LTB EQU *
DC C'DDDDD'
DC C'EEEEE'
.
.
TOP2LTB EQU *
DC C'FFFFF'
DC C'GGGGG'
.
.
MID2LTB EQU *
DC C'HHHHH'
DC C'GIIIII'
.
.
ENDLTB EQU *
DC C'VER01M03'
END
|
SRCH_PGM :
Code: |
.
.
* REGISTER DEFINITIONS
*
PARM0 EQU 0 TABLE VECTOR UPON INPUT
R0 EQU 0 TABLE VECTOR UPON INPUT
PARM1 EQU 1 ARGUMENT POINTER (INPUT)
TABDN EQU 1
ARGOFST EQU 1
EVEN EQU 2
ENTLEN EQU 2
POWER EQU 2
ODD EQU 3
ARGLEN EQU 3
WORKR EQU 3
R3 EQU 3
INDEX EQU 4
FUNCTION EQU 4
ENTLENC EQU 4
* FUNCTION ADDR (OUTPUT)
VECTOR EQU 5
NUMENT EQU 5
R5 EQU 5
R6 EQU 6
ARGUMENT EQU 6
TABLE EQU 7
TABL2 EQU 8
TBLCNT EQU 8
LOOPCT EQU 8
TABUP EQU 8
ARGLNG EQU 9
TABLTOP EQU 10
R11 EQU 11
BASE EQU 12 BASE REGISTER
SAVEREG EQU 13 POINTER TO SAVE AREA
CONDIT EQU 15
*
LR ARGUMENT,PARM1 SET ARGUMENT ADDR POINTER
LR TABLE,PARM0 GET ADDR OF BINSRCH PLIST
L CONDIT,0(TABLE) GET 1ST ADCON OF PLIST
LTR CONDIT,CONDIT HAS BINSRCH PLIST BEEN BUILT YET
BNZ TABLDONE YES
.
.
.
.
ADDREQU L NUMENT,8(PARM1)
L INDEX,TAB2ENT
SR NUMENT,INDEX
LA NUMENT,1(NUMENT)
ST NUMENT,TOP2
SRA INDEX,1
AR NUMENT,INDEX
ST NUMENT,MID2
L NUMENT,TAB1ENT
SRA NUMENT,1
LA NUMENT,1(NUMENT)
ST NUMENT,MID1
SR WORKR,WORKR
SR ENTLEN,ENTLEN
IC WORKR,LENOFARG
IC ENTLEN,FUNCLEN
AR ENTLEN,WORKR
L TABLTOP,0(PARM1)
SR TABLTOP,ENTLEN
LR TABL2,TABLTOP
LR R5,ENTLEN
L R11,TOP2
MR INDEX,R11
AR TABL2,R5
ST TABL2,TOPOF2
LR TABL2,TABLTOP
LR R5,ENTLEN
L R11,MID1
MR INDEX,R11
AR TABL2,R5
ST TABL2,MIDOF1
.
.
.
.
|
|
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
Just a couple of comments.- When an Assembler programmer wants to construct a table, a macro is used. This ensures the table entries are consistent.
- Usually, a binary search routine is entered knowing the number of table entries. The binary search calculates the address of the "middle" of the table rather than depend on the table definition to specify the "middle." This is not a big deal since a new "middle" is determined on the fly after each failed comparison.
|
|
Back to top |
|
|
Paul Voyner
New User
Joined: 26 Nov 2012 Posts: 52 Location: UK
|
|
|
|
It would help if you could explain what "But the new table is not picked correctly in the calling module." Abend ? No matches found ? What error messages ? |
|
Back to top |
|
|
saranyasakthivel
New User
Joined: 08 Jan 2015 Posts: 4 Location: India
|
|
|
|
Quote: |
It would help if you could explain what "But the new table is not picked correctly in the calling module." Abend ? No matches found ? What error messages ? |
Eventhough the entry is available in the table. Error message is thrown as 'Match not found' |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Are you ensuring the table entries are sorted in ascending sequence before loading the table? Binary search does not work if the table is not sorted into ascending sequence. One symptom of such a problem is not matching entries known to be In the table. |
|
Back to top |
|
|
saranyasakthivel
New User
Joined: 08 Jan 2015 Posts: 4 Location: India
|
|
|
|
Hi,
I have sorted my table in ascending order using syncsort. Do you think I should use any other options instead of syncsort to sort in ascending order? Plz let me know if there other options that will work better. |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
saranyasakthivel wrote: |
Hi,
I have sorted my table in ascending order using syncsort. Do you think I should use any other options instead of syncsort to sort in ascending order? Plz let me know if there other options that will work better. |
I don't understand. If you are "sorting" this alleged table, it seems moderately difficult to also assemble it.
It is not uncommon to construct a table from input data and then search the loaded table. Much of my recent work does this, though I tend to use the slightly less efficient hash search method rather than force the input data to be sorted. |
|
Back to top |
|
|
saranyasakthivel
New User
Joined: 08 Jan 2015 Posts: 4 Location: India
|
|
|
|
Quote: |
I don't understand. If you are "sorting" this alleged table, it seems moderately difficult to also assemble it.
It is not uncommon to construct a table from input data and then search the loaded table. Much of my recent work does this, though I tend to use the slightly less efficient hash search method rather than force the input data to be sorted. |
Actually this piece of work I am working on is an enhancement to the existing process. Binary search mechanism to search the table is in production already. I have enhanced only the part of the assembler table with more entries.
I would appreciate from you guys to make this work.
And is there any other sorting technique i can use to sort this table other than syncsort? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Syncsort is probably about as fast as you can sort the table -- system sorts are efficient and tough to improve upon. And as long as the table is sorted, why would you want to improve performance of the sort?
Second, binary search has a number of conditions and requirements and you need to ensure that your new table meets all those conditions and requirements.
Third, this is starting to sound like the kind of problem that can only be fixed by someone working at your site -- have you contacted your site support group or team leader or senior team members for assistance with the problem? They can help you debug the code whereas we on this forum can only make suggestions based on what you tell us (which by necessity does not include all the information and possibly not including the key fact to identify the issue -- not an indictment of you or your post, merely a fact). |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
I doubt anyone in this forum will attempt to analyze your code. Speaking from personal experience debugging binary search logic cannot be readily done by analysis; you have to run the code with assistance from a debugging package. I rarely do binary search for two reasons.- It is difficult to analyze and debug
- The table being searched must be fixed length and all the table entries must be in use. In most of my work the table is being constructed through the run; the search is being done to find possible duplicates. After the table is full I'll sort it, usually using my own sort routine, which usually beats the system sort packages, not because it's so great, but because there is essentially no start up logic and the table size is not all that large since it fits in storage. I've gone into the low 10^4 table elements with no significant issues.
Just from analysis, the constants at the start of your table look very wrong, or are at least suspect. |
|
Back to top |
|
|
|