Posted by Grant Foraker on January 07, 2019 at 09:59:52:
Wrote this to count the number of employees in a job. Thought I'd follow pre-POSITION style of code.
==============================================================
GetJobEmployeeCount:
LET JobEmployeeCount = 0
LET SORTKEY$ = PJOBNO$
LET MBMSG$ = 'A ' + PJOBNO$
MSGBOX MBMSG$
LET STLDATA$ = stlGet(PDER12STL, SORTKEY$, EXCP = GJC70) ! POSITION TO JOB
GJC10:
LET STLDATA$ = stlRead(PDER12STL)
LET MBMSG$ = 'C ' + STLDATA$
MSGBOX MBMSG$
IF SUB(STLDATA$,1,4) NE PJOBNO$ GOTO GJC90 ! END OF JOB
LET JobEmployeeCount = JobEmployeeCount + 1
MSGBOX 'D'
stlNext(PDER12STL) EXCP = GJC80 ! ADVANCE STL POINTER
GOTO GJC10
GJC70:
LET MBMSG$ = 'B ' + STR(EXCP)
MSGBOX MBMSG$
IF EXCP NE 50 GOTO ProgramError ! E50 is E32 for STL
stlNext(PDER12STL) EXCP = GJC80 ! ADVANCE STL POINTER
GOTO GJC10
GJC80:
LET MBMSG$ = 'E ' + STR(EXCP)
MSGBOX MBMSG$
IF EXCP EQ 2 GOTO GJC90 ! END OF STL
GOTO ProgramError
GJC90:
RETURN
========================================================
Program gets to "A" and then "B". Comet was bent, folded, stapled and mutilated at the "stlRead(PDER12STL)". Tried "C" in front and it got there OK.
Since the number of records in the STL is usually under a few hundred, I rewrote the routine to read from front to back and count the matches.
Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.