PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Error 33's  (Read 1515 times)

michaelgreer

  • Diamond Member
  • *****
  • Posts: 129
    • View Profile
Error 33's
« on: July 15, 2019, 10:45:30 AM »
 I have a fairly straight forward loop of code that is throwing error 33's as it reads through larger files.  Any pointers on how to check "remaining" memory, memory used, gosub/call stack size.  I am not seeing anything which betrays a huge resource usage.

James Zukowski

  • Diamond Member
  • *****
  • Posts: 297
    • View Profile
Re: Error 33's
« Reply #1 on: July 15, 2019, 11:06:11 AM »
Is this loop loading a memory file, list_box, or something else like that?
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Mike King

  • Diamond Member
  • *****
  • Posts: 3811
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Error 33's
« Reply #2 on: July 15, 2019, 11:56:39 AM »
What are you doing within the loop?
If its a short loop could you post it here?

Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

michaelgreer

  • Diamond Member
  • *****
  • Posts: 129
    • View Profile
Re: Error 33's
« Reply #3 on: July 15, 2019, 12:28:44 PM »
Here is he code. The issue is the 1300-1800 block. It fails on around 1440.  This is basically checking for conformity between nomads field definitions and the actual data:

0010 ! AKCFI - Check of SQL table
0030 ! Built from Mic's SQL_CHECK_TABLE program.
0100 ! TABLES
0110 ddf=hfn; open (ddf)"providex.ddf"
0120 dde=hfn; open (dde)"providex.dde"
0130 open (hfn)"meta/DO/DOFILH"; dofilh=lfo
0195 goto INIT
0200 LOG_FILE:
0210 erase table$+".txt",err=*next
0220 serial table$+".txt"
0230 log_file=hfn; open lock (log_file)table$+".txt"
0240 log_file$=fib(log_file); log_file$=log_file$(25,60)
0295 return
0500 INIT:
0510 perform "START_UP"
0520 rec_cnt=0
0530 err_cnt=0
1000 MAIN:
1010 input 'CS',@(5,5),"Table [ODBC or FACTS] (q/Q to QUIT): ",table$
1011 if ucs(table$)="Q" then goto END_PGM
1020 open (hfn,err=*next)"NP"; np=lfo
1023 if len(table$)=6 then read (dofilh,key="01"+ucs(table$)+"1",dom=*next)*,*,*,*,table$
1025 table$=ucs(table$)
1030 read record (ddf,key=table$,kno=1,dom=TABLE_NOF)ddf$; gosub LOG_FILE
1035 print @(5,15),"Checked: "
1040 DDF_ASSIGN:
1050 ddf_1$=ddf$(1,pos(chr(138)=ddf$)-1); ddf$=ddf$(pos(chr(138)=ddf$)+1)
1060 ddf_2$=ddf$(1,pos(chr(138)=ddf$)-1); ddf$=ddf$(pos(chr(138)=ddf$)+1)
1070 print @(5,10),"Processing: "+ddf_2$
1080 table_name$=ddf_2$(len(ddf_2$)-5,6)
1090 ddf_key$=kep(ddf,kno=0)
1200 OPEN_TABLE:
1210 table=hfn; open (table)ddf_2$
1220 template_prog$="prog/"+table_name$(1,2)+"/"+table_name$(1,2)+"STRN;DIM_"+table_name$
1230 perform template_prog$
1300 NEXT_RECORD:
1310 read record (table,end=ALL_DONE)f$
1320 rec_cnt++
1330 if mod(rec_cnt,10)=0 then print @(15,15),'CL',str(rec_cnt),
1400 PRIME_DDE:read (dde,key=ddf_key$,dom=*next)
1410 DDE_LOOP: dde_key$=key(dde,end=NEXT_RECORD)
1415 if dde_key$(1,len(ddf_key$))<>ddf_key$ then goto NEXT_RECORD
1420 read record (dde,key=dde_key$)dde$
1430 DDE_ASSIGN:
1440 dde_1$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) ! FIELD VARIABLE
1441 dde_2$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) ! FIELD NAME
1442 dde_3$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) ! FIELD DESC
1443 dde_4$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) ! FIELD TYPE
1444 dde_5$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) ! FIELD LENGTH
1445 dde_6$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) !
1446 dde_7$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) !
1447 dde_8$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) !
1448 dde_9$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) !
1449 dde_10$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) !
1450 dde_11$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) !
1451 dde_12$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) !
1452 dde_13$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) !
1453 dde_14$=dde$(1,pos(chr(138)=dde$)-1); dde$=dde$(pos(chr(138)=dde$)+1) ! DATE
1495 field_val$=evs("f."+dde_2$+"$")
1500 CHECK_FIELDS:
1505 local tmp$
1510 STRING:if ucs(dde_4$)<>"S" then goto NUMBER ! SIMPLY CHECKING FIELD LENGTH
1520 if len(field_val$)>num(dde_5$) then tmp$="Field Len Exceeded: "+dde_1$+" Def Len: "+dde_5$+" Len: "+str(len(field_val$))+" Table Key: "+kep(table); print (log_file)tmp$; if np then print (np)tmp$ end_if ; err_cnt++ ! ; escape ! Field Length Exceeded
1595 ! goto DDE_LOOP
1600 NUMBER:if ucs(dde_4$)<>"N" then goto DATE
1610 num_check=num(field_val$,err=*next); goto DATE
1620 tmp$="Bad Numeric Field: "+dde_1$+" "+field_val$+" Table Key: "+kep(table); print (log_file)tmp$; if np then print (np)tmp$ end_if ; err_cnt++ ! escape
1700 DATE:if len(dde_14$)>3 and dde_14$(1,4)="DATE" then goto *next else goto DDE_LOOP
1701 date_check$=""
1705 if cvs(field_val$,3)="" then goto DDE_LOOP
1706 if len(field_val$)<6 then goto BAD_DATE
1707 if cvs(field_val$,3)="244B01" then goto DDE_LOOP ! "ssi blank date
1710 date_check$=fnldate$(field_val$,"","")
1715 month$=date_check$(1,2),day$=date_check$(4,2),year$=date_check$(7,4)
1720 if num(month$)<1 or num(month$)>12 then goto BAD_DATE
1725 if num(year$)<1900 or num(year$)>2030 then goto BAD_DATE
1730 if num(day$)<0 then goto BAD_DATE
1735 if pos(month$="01,03,05,07,08,10,12")>0 and num(day$)>31 then goto BAD_DATE
1740 if pos(month$="04,06,09,11")>0 and num(day$)>30 then goto BAD_DATE
1742 if mod(num(year$),4)=0 then leap_yr=1 else leap_yr=0
1745 if month$="02" and num(day$)>28+leap_yr then goto BAD_DATE
1750 goto DDE_LOOP
1760 BAD_DATE: tmp$="Bad Date Field: "+dde_1$+" "+field_val$+" / "+date_check$+" Table Key: "+kep(table); print (log_file)tmp$; if np then print (np)tmp$ end_if ; err_cnt++
1895 goto DDE_LOOP
5000 END_PGM:
5010 end
5100 !
5110 call "prog/AK/AKCFI" ! Clip this line and save to "*cmd/cfi"
8000 ! errors
8010 TABLE_NOF:print 'CS',@(5,5),"Table Not Found"; wait 5; goto MAIN
9900 ALL_DONE:print 'LF','LF',"FINISHED, Err Count: ",str(err_cnt),
9905 print 'LF','LF',"Log File: ",log_file$
9910 end
15000 def fnldate$(local x$, local y$, local z$)
15010 local return$
15020 return$=dte(dec(ath(x$)):"%Mz/%Dz/%Yl")
15070 if x$="244B01" then return$=y$
15080 if x$="2685B1" then return$=z$
15090 return return$
15095 end def

Jane Raymond

  • Staff
  • Diamond Member
  • *****
  • Posts: 280
    • View Profile
    • PVX Plus Technologies
Re: Error 33's
« Reply #4 on: July 15, 2019, 01:16:46 PM »
Here's a quick guess:
The LOCAL tmp$ variable at 1505 is being created every time through the loop. Try creating it before entering the loop and just set it to "" at 1505.  Alternately make Check_Fields a separate routine and GOSUB to it to make tmp$ local to the routine.
Jane Raymond
Software Developer
PVX Plus Technologies Ltd.