FoxPro Code Understanding

I have the following code that needs explanation:
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

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
tgatif2000Author Commented:
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
This is just variable declaration part of some program.

SELECT TIMCART  && sets the workarea where TIMCART table is open
scatter memvar   && creates a set of private variables containing data from the current TIMCART record

All lines beginning with PUBLIC keyword define memory variables with public visibility. These variables are of logical data type by default and initialized to .F. (False)

The rest are values assignment commands to variables, e.g.

r_cusxrf    = ' ' && CCN +CSN2 to find customer UPC code instead UPC

assigns one space to r_cusxrf public variable (the data type of this variable is changed from logical to text)

* starts comment line
&& starts inline comment

Command descriptions:
STORE (equiv to =) -

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day 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

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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.