I have been converting code from R83 to Prime Information, Advance Pick to Unidata, Sequoia Pick to Unidata, D3 to Universe, and even Unidata to Universe, I have seen some really awful code and very morbid. Of course, you are thinking some of the latest Basic commands that I use daily in Universe did not exist in R83 so those programmers did the best they could. While I do not disagree, I am looking at code from customers in 2023 that should have been updated sometime in the last 20 years or at least in the last 10 years.
I have detailed below my comments with what I found and what I think it should be. I will ignore for the time being GOTO, GOSUB, and ON RESPONSE, for example. I would love to see what you have found as well because it just makes me LOL when I see it.
* Using COUNT instead of DCOUNT
MY.ARRAY = 5:@FM:7:@FM:8
MAX.FM = COUNT(MY.ARRAY,@FM)+ 1
* Should be
MAX.FM = DCOUNT(MY.ARRAY,@FM)
* Not knowing about WHILE in a LOOP statement
EXECUTE 'SELECT VOC'
EOF = 0
LOOP READNEXT ID ELSE EOF = 1
IF EOF THEN EXIT
REPEAT
* Should be
LOOP WHILE READNEXT ID
REPEAT
* Parsing though data instead of CHANGE command
MY.DATA = "Welch, Bob;McVie John;Buckingham, Lindsey"
MY.LEN = LEN(MY.DATA)
FOR X = 1 TO MY.LEN
IF MY.DATA[X,1] = ';' THEN MY.DATA[X,1] = @FM
NEXT X
* Should be
MY.DATA = CHANGE(MY.DATA,";",@FM)
* Not using case
MY.METHOD = 'CreateReport'
IF MY.METHOD = 'UpdateRecord' THEN
END
IF MY.METHOD = 'CreateReport' THEN
END
* Should be
BEGIN CASE
CASE MY.METHOD = 'UpdateRecord'
CASE MY.METHOD = 'CreateReport'
END CASE
* Testing for Universe or Unidata
UNIVERSE = @FALSE
OPEN '&PH&' TO DUMMY ELSE UNIVERSE = @TRUE
* Should be
IF SYSTEM(9010) = "UV" THEN UNIVERSE = @TRUE
* Finding a JSON value
JSON = \\{"IdCode":"2","Description":"Route Not Run","DefaultValue":"0"}\\
JSON = CHANGE(JSON,\\","\\,\\"\\:@FM:\\"\\)
JSON = CHANGE(JSON,\\":"\\,\\"\\:@VM:\\"\\)
JSON = CONVERT(\\{"]\\,"",JSON)
MAX.FM = DCOUNT(JSON,@FM)
FOR X = 1 TO MAX.FM
IF JSON
------------------------------
Doug Averch
Owner
U2 Logic
------------------------------