What is the business rules in the code bellow.

felicia

New Member
The other code that I posted was just part of the whole procedure. Bellow is a complete procedure. Would you please help me identify the business rules from this code. What do I look for and where. I have not programmed in Progress before as a result I am finding it difficult to identify the business rules in this particular code. I need guidance on what to look for. Thanks.

LoadFile Procedure
PROCEDURE LoadFile :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/

def var vString as char no-undo.
def var vCode as char no-undo.
def var vValue as char no-undo.
def var vSeqNo as int no-undo init 0.
def var vLog as logical no-undo.

pF-Message:Screen-Value = "Loading file " + pOrderFile.
vFileName = pInputDir + pOrderFile.
vLog = session:set-wait-state ("wait").
input stream t_input from value(vFileName) no-echo.
repeat:
import stream t_input unformatted vString.
vString = REPLACE(vString,"|":U,"-":U).
process events.

if entry(1, vString,"=") = vString then
do:
assign vCode = ""
vValue = vString.
end.
else
do:
assign vCode = entry(1, vString, "=")
vValue = trim(substring(vString, index(vString, '=')
+ 1)).
end.
create tEfile.
assign tEFile.SeqNo = vSeqNo + 1
tEfile.Tag = vCode
tEfile.TagValue = vValue.
vSeqNo = vSeqNo + 1.
end.
input stream t_input close.
input close.
vSeqNo = 0.
vLog = session:set-wait-state ("").

END PROCEDURE.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

&ENDIF

&IF DEFINED(EXCLUDE-LoadNotes) = 0 &THEN
 
I am looking for a translation of the code into a simple English language that someone who is not a programmer can easily understan after reading it. Thanks.
 
From the little that I have read about progress and business rules. I thought the "Do and else" part of the code is where the business rules are.. That is the actions that has to take place. That's where you can abstract the business rules. The link you gave me is not working. Thanks
 
I thought the "Do and else" part of the code is where the business rules are..
if, do, else etcetera are not much different then in other languages.

The link you gave me is not working
I just fixed that. (Copy paste error) :-)
 
Again, there is a lot of information missing here ... along with some very questionable coding practice (as well as being hard to read without the indents - use [ code ] and [ /code ] around the quoted program).

Issues:

The comment at the top says no parameters, but the very first line of action code refers to pOrderFile, which is not locally defined. It *should* be passed in as a parameter to properly encapsulate the procedure.

Whenever you do an input from like this, you should precede it with a search or file-info to validate that there really is a file there to read and it has appropriate permissions. And, of course, there should be error handling if it isn't.

Replacing one delimiter with another is just unnecessary and accomplishes nothing. All of the code below could have been written using the pipe delimiter.

We are missing the definitions of the temp-table. It also should have been passed as a parameter.

Setting the sequence back to zero after the input is done has no effect because it is a local variable which goes out of scope when the procedure ends.

Which said, as Casper has said, all this code does is to take its input from an OS file, read lines, and parse them into either a code/value pair or, when the delimiter is missing, assigns a blank code and takes what is on the line as the value. Why this is being done and what will be done with the results is not indicated by this code.
 
Back
Top