Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Simple Data Structures

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Simple Data Structures
#13400
Posted by: PeterJ 2010-11-08 15:19:54 Last edited by: PeterJ 2010-11-08 15:22:40 (Total edited 2 times)
Simple Data Structures don't need conversions and don't have a fixed structure either. The items in the record are simply separated by a string. I usually use ";;"
This makes the definition much simpler as we just concatenate the items (with separator) or use the PARSE statement to extract them

Example:  

/* -----------------------------------------------------------------------------------
 * Define Simple Structure 
 * -----------------------------------------------------------------------------------
 */
structure="Name IDNo Telephone Address"    /* name required items */
strdef1=declare('DEFINE',structure,";;")         /* construct structure */ 
SAY "Defined, PARSE string:" strdef1    
/* Set Variables, which will become part of the record */ 
NAME="John Smith"
idno="2178"
telephone=442518234
ADDRESS="Leicester Court Road 2356"
inrec=declare('PUT',strdef1)
SAY "Constructed Record: "inrec
/* Drop variables, and re-construct them from record */
DROP NAME idno telephone ADDRESS 

a=declare('GET',strdef1,inrec)

SAY 'Name     : 'NAME
SAY 'IDNo     : 'idno
SAY 'Telephone: 'telephone
SAY 'Address  : 'ADDRESS

EXIT
the DECLARE procedure is attached!
Declare.rex
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sun 2017-11-19  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0