PICK BASIC Reference Manual --~I
Total Page:16
File Type:pdf, Size:1020Kb
PICK BASIC reference manual --~i 88AOO778A02 "'':: . CCIl ICOOI 01 I Tn .. ..OTlnll I RECORD OF REVISIONS Title: PICK BASIC Reference Manual DOOlment No. 88A00778A02 Da te Revis ion Record --------------+------------------------------------------------------------- Mar 84 Original Issue Feb 85 Revision A02 - Change Package (85A00517A01) THIS DOCUMENT CONTAINS PROPRIETARY INFORMATION WHICH SHALL NOT BE REPRODUCED OR TRANSFERRED TO OTHER DOCUMENTS OR DISCLOSED TO OTHERS, OR USED FOR MANUFACTURING OR ANY OTHER PURPOSE WITHOUT PRIOR WRITTEN PERMISSION OF GENERAL AUTOMATION, INC. ii PICK BASIC reference manual 88AOO778A02 Copyright CI by Gener,' Automation. Inc. 1045 South East Street P.O. Box 4883 An,heim. Ca'ifornia 92803 (7141778-4800 (800)854-6234 TWX 91 ().591.1695 TELEX 685·513 RECORD OF REVISIONS Title: PICK BASIC Reference Manual Document No. 88A00778A02 I \ Da te I Revis ion Record I \--------------+-------------------------------------------------------------1 I 1 \ 1 Mar 84 1 Original Issue I I I \ Feb 85 I Revision A02 - Change Package (85A00517A01) 1 I \ I \ I \ I \ I I I I I I I I I 1 I I I THIS DOCUMENT CONTAINS PROPRIETARY INFORMATION WHICH SHALL NOT BE REPRODUCED OR TRANSFERRED TO OTHER DOCUMENTS OR DISCLOSED TO OTHERS, OR USED FOR MANUFACTURING OR ANY OTHER PURPOSE WITHOUT PRIOR WRITTEN PERMISSION OF GENERAL AUTOMATION, INC. ii 88A00778A FOREWORD This document is one of a family of ZEBRA reference manuals devoted to PICK processors that are on call within the PICK operating system. Before reading this document and using the processor described, it is recommended that you first become familiar with the PICK terminal control language and file structure. These subjects are thoroughly covered in 88A00782A, listed below with other documents covering PICK processors. Document No. Title 88A00757A PICK Operator Guide 88A00758A ACCU-PLOT Operator Guide 88A00759A COMPU-SHEET Operator Guide 88A00760A Quick Guide for the PICK Operating System 88A00774A PICK Utilities Guide 88A00776A PICK ACCESS Reference Manual 88A00777A PICK SPOOLER Reference Manual 88A00779A PICK EDITOR Referance Manual 88A00780A PICK PROC Reference Manual 88A00781A PICK RUNOFF Reference Manual 88A00782A Introduction to PICK TCL and FILE STRUCTURE 88A00783A PICK JET Word Processor Guide !MACCU-PLOT is a trademark of ACCUSOFT Enterprises TMcOMPU-SlmET is a trademark of Raymond-Wayne Corporation !MpICK is a trademark of PICK Systems TMZEBRA is a trademark of General Automation, Inc. iii/iv 88A00778A TABLE OF CONTENTS Section Title 1 INTRODUCTION • • • • • • • • • • • • • 1-1 1.1 THE BASIC LANGUAGE. • • • • • ••• . 1-1 1.2 BASIC FILE STRUCTURE. • • • • • •••• . 1-3 1.2.1 CREATING BASIC FILES: CREATE-PFILE • . 1-3 1.3 BASIC PROGRAMS • • • • • • • • • • • • • • • • • • 1-4 1.3.1 BASIC StATEMENTS. • • • • • • • • • • • 1-4 1.3.2 COMMENTS WITHIN THE BASIC PROGRAM. • • •• 1-5 1.3.3 SPECIAL PICK USE OF BASIC. • • • • •••••• 1-5 1.4 CREATING AND COMPILING WITH BASIC. • • • • • • • 1-6 1.4.1 FORMAT VERB. • • • • • • • • • • • • 1-7 1.4.2 BASIC COMPILER OPTIONS ••••••••• 1-8 1.5 EXECUTING BASIC PROGRAMS • • • • • • • • • • 1-10 1.5.1 RUNNING BASIC PROGRAMS FROM A PROC • • • • 1-11 1.5.2 ALTERING EXECUTION TIME: RQM AND SLEEP STATEMENTS. 1-12 1.6 PROGRAM SHARING. • • • • • • • • • • • • 1-13 1.6.1 CATALOG VERB. 1-13 1.6.2 DECA1ALOG VERB • 1-14 2 DATA REPRESENTATION •••••••••••••• . 2-1 2.1 CONSTANTS AND VARIABLES. 2-1 2.2 ASSIGNING VALUES TO VARIABLES •• 2-3 2.2.1 SIMPLE ASSIGNMENT STATEMENT. 2-3 2.2.2 CLEAR STATEMENT. • • • • • • • • 2-3 2.2.3 EQUATE STATEMENT • • . 2-5 2.3 MULTIPLE DATA REPRESENTATION • 2-7 2.3.1 ARRAyS •••••• . 2-7 2.3.2 DIM STATEMENT •••• . 2-8 2.4 ASSIGNING VALUES TO ARRAYS • 2-9 2.4.1 MAT ASSIGNMENT STATEMENT ••••••• 2-9 2.4.2 MAT COpy STATEMENT • 2-9 2.5 SELECTING NUMERIC PRECISION: PRECISION DECLARATION • 2-11 3 FORMING EXPRESSIONS. • • • • • • • • • 3-1 3.1 ARITHMETIC EXPRESSIONS 3-1 3.2 STRING EXPRESSIONS •• 3-4 3.3 RELATIONAL EXPRESSIONS ••••• 3-6 3.3.1 PATTERN MATCHING •• 3-8 3.4 LOGICAL EXPRESSIONS. • • 3-10 4 PROGRAM CONTROL AND OPERATION. • • • • 4-1 4.1 UNCONDITIONAL BRANCHING. 4-1 4.1.1 GOTO STATEMENT. 4-1 4.2 COMPUTED BRANCHING •••• . 4.-2 4.2.1 ON GOTO STATEMENT. 4-2 4.3 CONDITIONAL BRANCHING. • • 4-4 4.3.1 SINGLE-LINE IF STATEMENT. 4-4 4.3.2 MULTI-LINE IF STATEMENT. 4-6 4.3.3 CASE STATEMENT •••••• 4-8 v 88A00778A Section Title Page 4.4 NO OPERATIONS. 4-10 4.4.1 NULL STATEMENT •••• . 4-10 4.5 PROGRAM LOOPING. • • • • • 4-11 4.5.1 FOR AND NEXT STATEMENTS. 4-11 4.5.1.1 WHILE and UNTIL Clauses. 4-13 4.5.1.2 Nesting. 4-14 4.5.2 LOOP STATEMENTS. 4-15 4.6 PROGRAM TERMINATION. • • · . 4-17 4.6.1 END, STOP AND ABORT STATEMENTS. 4-17 4.7 PROGRAM SECURITY • • • • 4-19 4.7.1 BREAK AND ECHO STATEMENTS. 4-19 5 SUBROUTINES AND INTERPROGRAM COMMUNICATION • 5-1 5.1 INTERNAL SUBROUTINES • 5-1 5.1.1 GOSUB STATEMENT. 5-1 5.1.2 COMPUTED GOSUB STATEMENT • . 5-1 5.1.3 RETURN AND RETURN TO STATEMENTS. 5-3 5.2 EXTERNAL SUBROUTINES • . 5-5 5.2.1 CALL STATEMENT ••••••• 5-5 5.2.2 SUBROUTINE STATEMENT • . 5-5 5.2.3 ARRAY PASSING AND INDIRECT CALLS • 5-7 5.2.4 EXECUTE STATEMENT. 5-9 5.2.4.1 EXECUTE Statement I/O • 5-9 5.2.4.2 Allocating EXECUTE Workspaces and Nested EXECUTE Levels • • 5-11 5.2.4.3 Environment Changes After Using the EXECUTE Statement • • • • • 5-12 5.3 INTERPROGRAM COMMUNICATION • • . 5-14 5.3.1 CHAIN STATEMENT. 5-14 5.3.2 DATA STATEMENT ••••• 5-16 5.3.3 COMMON STATEMENT 5-18 5.3.4 ENTER STATEMENT. 5-20 6 INTRINSIC FUNCTIONS. 6-1 6.1 NUMERIC FUNCTIONS. 6-1 6.1.1 ABS •• 6-1 6.1.2 INT. 6-1 6.1.3 REM AND MOD. 6-1 6.1.4 SQRT •••• 6-2 6.1.5 RND •• . · . 6-2 6.2 TRIGONOMETRIC FUNCTIONS. 6-4 6.2.1 COSINE. 6-4 6.2.2 SINE. 6-4 6.2.3 TANGENT. 6-4 6.2.4 LOGARITHM. 6-4 6.2.5 EXPONENTIAL. 6-5 6.2.6 POWER. · . 6-5 6.3 LOGICAL FUNCTIONS. 6-6 6.3.1 NOT. 6-6 6.3.2 NUM AND ALPHA. 6-6 vi 88A00778A Section Title 7 FILE HANDLING • • • • • • • • • • • • • • 7-1 7.1 FILE SELECTION FOR I/O • • • • 7-1 7.1.1 OPEN STATEMENT. • • • • • • • • 7-1 7.2 CLEARING A FILE. • • • • • • • • • • • • • • • • 7-3 7.2.1 CLEARFILE STATEMENT. •• • • • • • • 7-3 7.3 ACCESSING FILE ITEMS • • • • • • • • • • • • 7-5 7.3.1 READ STATEMENT. • • • • • • 7-5 7 .3.2 SELECT STATEMENT • • • • • • • • • • • 7-7 7.3.3 READNEXT STATEMENT. • • • • • • • • 7-9 7.4 MODIFYING AND DELETING FILE ITEMS. • 7-11 7.4.1 WRITE STATEMENT. • • • • • • • • • . 7-11 7.4.2 DELETE STATEMENT. • • • • • • • • • • • • • 7-11 7.5 ACCESSING AND UPDATING SINGLE ATTRIBUTES. 7-13 7.5.1 READV STATEMENT. • • • • • • • • • • . • • • 7-13 7.5.2 WRITEV STATEMENT. • • • • • • • • 7-15 7.6 ACCESSING AND UPDATING MULTIPLE ATTRIBUTES. 7-17 7.6.1 MATREAD STATEMENT. • • • • 7-17 7.6.2 MATWRITE STATEMENT. • • • • • • • • 7-17 7.7 MULTIUSER FILE AND EXECUTION LOCKS. • • • • 7-19 7.7.1 BASIC LOCKS. • • • • • • • • • • •• 7-19 7.7.1.1 LOCK Statement. • • 7-19 7.7.1.2 UNLOCK Statement. 7-19 7.7.2 READ WITH LOCK FOR UPDATING: READU, READVU, AND MATREADU STATEMENTS. • • • • • • • • • • 7-21 7.7.3 WRITE WITH LOCK FOR UPDATING: WRITEU, WRITEVU, AND MATWRITEU STATEMENTS • • • • • 7-23 7.7.3.1 RELEASE Statement. • • • • 7-23 7.8 PROC I/O • • • • • • • • • • 7-25 7 .8. 1 PROCREAD STATEMENT • • • • • 7-25 7.8.2 PROCWRITE STATEMENT. 7-25 7.9 TAPE I/O • • • • • • • • • • 7-26 7.9.1 READT STATEMENT. • • • • • • • 7-26 7.9.2 WRITET STATEMENT. • • • • • • • 7-26 7.9.3 WEOF AND REWIND STATEMENT. 7-27 7.10 STRING HANDLING. • • • • • • • • 7-28 7.10.1 STRING SEARCHING: FIELD, COL1 AND COL2 FUNCTIONS. 7-28 7.10.1.1 FIELD. • • • • • • • • • • • • • • • •• 7-28 7.10.1.2 COL1, COL2 • • • • • • • • • • • • • • • 7-28 7.10.2 SEARCHING FOR A SUBSTRING: INDEX FUNCTION. • • • • 7-30 7.10.3 COUNTING OCCURRENCES OF A SUBSTRING: COUNT FUNCTION 7-32 7.10.4 COUNTING DELIMITED VALUES: DCOUNT FUNCTION. 7-33 7.10.5 STRING SPACING: SPACE AND TRIM FUNCTIONS. • • • • 7-34 7.10.5.1 SPACE. • • • • • • • • • • • • • • • • • 7-34 7.10.5.2 TRIM. • • • • • • • • • • • • • • 7-34 7.10.6 STRING REPETITION AND LENGTH DETERMINATION 7-36 7.10.6.1 STR. • • • •• •••• • • 7-36 7.10.6.2 LEN. • • • • • • • • • • • • • • • • 7-36 vii 88A00778A Section Title 7.11 DYNAMIC ARRAY OPERATIONS • • 7-38 7 • 11. 1 DYNAMIC ARRAY STRUCTURE. 7-38 7.11.2 LOCATE STATEMENT. 7-40 7.11.3 EXTRACT FUNCTION ••••••• 7-42 7.11.4 REPLACE FUNCTION. 7-44 7.11.5 INSERT FUNCTION. 7-46 7.11.6 DELETE FUNCTION. 7-48 8 TERMINAL AND PRINTER INPUT AND OUTPUT. 8-1 8. 1 TERMINAL INPUT • • • • • • • • • • • 8-1 8.1.1 INPUT AND PROMPT STATEMENTS. 8-1 8.1.2 MASKED INPUT • • • • • • • • • • • 8-3 8.1.3 OTHER INPUT FOR}tS ••••• 8-4 8.2 SYSTEM OUTPUT: DEVICE SELECTION. 8-5 8.2.1 PRINTER STATEMENTS ••• 8-5 8.2.2 PRINT STATEMENT •••••• 8-7 8.2.2.1 Tabulation and Concatenation in PRINT Statement • 8-9 8.2.3 CRT STATEMENT. • • • • • • • • • • • • • 8-11 8.3 OUTPUT FORMATTING. • • • • • • • • • • • • • • • 8-12 8.3.1 TERMINAL CURSOR CONTROL AND SCREEN FUNCTIONS: @•• 8-12 8.3.2 FORMAT STRINGS: NUMERIC AND FORMAT MASK CODES. 8-14 8.3.3 HEADING AND FOOTING STATEMENTS • • • • • • 8-18 8.3.4 PAGE STATEMENT •••• 8-20 8.3.5 CURRENT TIME AND DATE: TIME, DATE, AND TIMEDATE FUNCTIONS • • • • • • • • 8-21 8.3.6 QUERYING CURRENT VALUE OF SYSTEM FUNCTIONS: SYSTEM 8-23 8.3.7 INPUT AND OUTPUT CONVERSION: ICONV AND OCONV • 8-24 8.3.8 FORMAT CONVERSION: ASCII, EBCDIC, CHAR AND SEQ 8-26 9 DEBUGGING BASIC PROGRAMS • • • • 9-1 9.1 THE BASIC DEBUGGER ••• , .