Link to home
Start Free TrialLog in
Avatar of tgatif2000
tgatif2000

asked on

FoxPro Code Understanding

I have the following code that needs explanation:
SELECT TIMCART
scatter memvar
public m.timcartrec, m_stopchk, m_loaddate, m_loadtime
public m_rec, atprocess, m_preclist, m_precision, m_viewerr, m_colinxrun
public codeval1, m_country, m_origincd, m_origin
public printorigin, printocode, m_madein, m_precision, printopn, printinspec, printpkpri, printccn, printtcn
public printcusnum, printcsn1, printcsn2, printassy, printassyseq, printseqnum, printcommod, printqty, printassy
public printseqnum, printdate, printdatecode, printship, atcodeval, atcodeval1, line_cd1, pinspec, ddmy, mmy
public M.CNHdate, m_sealdim, m_multipack, m.printqty
public r_cusxrf, r_inspec, r_timcross, r_timassy, r_barinf, r_select, r_sys1map, r_origin, r_machset
public parsename[10], xcopn[10], xinspec[10], xqpa[10], xaep[10], xprecision[10], xpqpaopn[10], xpqpaopn2[10], xpinspec[10]
public m_cartrec, m_carterr, m_commorder, m_splitasy, m_splitrec, m_stopchk
public r_barinf, r_cusxrf, r_upc, r_carton, r_printmsg, r_printbc, r_machset, r_inspec, r_origin
public PrintOPN,PrintInspec,m_mktdesc,m.timcartrec,m_errfl
* Declare variables set in FINDRECS() for relational keys into databases
r_cusxrf    = ' ' && CCN +CSN2 to find customer UPC code instead UPC
r_inspec    = ' ' && INSPEC allocated
r_timcross  = ' ' && OPN +INSPEC modified for SET/KIT assemblies
r_timassy   = ' ' && OPN +INSPEC modified for SET/KIT assemblies
r_barinf    = ' ' && CUSNUM to find barcode type (00=none, 22=3of9, or 44=UPC)
r_select    = ' ' && PK +CCN +TCN +BARTYPE +SYSTYPE. CCN, TCN, and BARTYPE may be space masked for Intermec formats
r_sys1map   = ' ' && SELECT.LABELMAP if not empty, otherwise SELECT.FORMATOFF
r_origin    = ' ' && origin_cd from Red Prairie
r_machset   = ' ' && 10 character TCN or CCN, +SYSCON.SYSTYPE

Open in new window

Avatar of tusharkanvinde
tusharkanvinde
Flag of India image

Do you know programming. Which language are you familiar with

There isn't really anything in that code.

The first line moves the values of all the fields in some table into memory variables with the same name

Then you are creating a whole lot of variable as public (which is quite a bad programming practice). One of those line creates arrays.

Then you are making some of those values as 0 length character
Avatar of tgatif2000
tgatif2000

ASKER

I am familiar with VB.Net but not with Visual FoxPro.

Are line 1, 2, and 3 related to each other
in line no. 3, what is the difference between m.timcartrec and  m_stopchk
what is happening at line 16
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"m."  is just a memory variable prefix. It is OK if you omit it in PUBLIC command:

public m.timcartrec
is same as
public timcartrec

"m_" is just a part of the variable name "m_stopchk"

m. is used to distinguish between memory variable and table column if some ambiquity could happen.

TIMCART is a table. The command

SELECT TIMCART
scatter memvar

will create memory variables, one for each column. Each memory variable will have the same name as that of the column. The table will have one record marked as the current record. The values of the columns in this record will be copied to the created memory variables.

All memory variables in VFP can also be prefixed with m. or m-> to indicate that they are memory variables to distinguish them from columns of tables. So m.timcartrec is a memory variable called timcartrec.

Line 16
r_cusxrf    = ' '

As P Celba as mentioned, the memory variable r_cusxrf is being assigned the value ' ' or 1 space.