DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 1 Intermediate DCL Programming David J. Dachtera.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Introduction to C Programming
DCL Programming Hands-on Session David J Dachtera DJE Systems -
Intermediate Code Generation
R4 Dynamically loading processes. Overview R4 is closely related to R3, much of what you have written for R3 applies to R4 In R3, we executed procedures.
CS 450 Module R1. R1 Introduction In Module R1, you will implement a user interface (command handler). There are a couple of options: ▫Command Line: interface.
Writing better DCL procedures A simple guide by Andy Park
PL/SQL.
Chapter 10 Introduction to Arrays
Objectives Using functions to organize PHP code
Lecture-5 Though SQL is the natural language of the DBA, it suffers from various inherent disadvantages, when used as a conventional programming language.
CS 898N – Advanced World Wide Web Technologies Lecture 8: PERL Chin-Chih Chang
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
CS 497C – Introduction to UNIX Lecture 33: - Shell Programming Chin-Chih Chang
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
Program Design and Development
C++ for Engineers and Scientists Third Edition
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
CTEC 1863 – Operating Systems Shell Scripting. CTEC F2 Overview How shell works Command line parameters –Shift command Variables –Including.
DJE Systems©1999 All Rights ReservedIntroduction to DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 1 Intro to DCL Programming David J. Dachtera.
DCL - Digital Command Language Matthias Schmitt
MySQL in PHP – Page 1 of 17CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: MySQL in PHP Reading: Williams &
Tutorial 14 Working with Forms and Regular Expressions.
Reusable Code For Your Appx Processes Presented By: Gary Rogers.
Chapter 7: Arrays. In this chapter, you will learn about: One-dimensional arrays Array initialization Declaring and processing two-dimensional arrays.
Programming Languages -1 (Introduction to C) arrays Instructor: M.Fatih AMASYALI
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Linux Operations and Administration
Arrays An array is a data structure that consists of an ordered collection of similar items (where “similar items” means items of the same type.) An array.
Flow of Control Part 1: Selection
© 2006 DJE Systems, All Rights Reserved The information contained herein is subject to change without notice GET CONNECTED People. Training. Technology.
Interpretation Environments and Evaluation. CS 354 Spring Translation Stages Lexical analysis (scanning) Parsing –Recognizing –Building parse tree.
Web Database Programming Week 3 PHP (2). Functions Group related statements together to serve “a” specific purpose –Avoid duplicated code –Easy maintenance.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 7 Files.
Chapter 10: BASH Shell Scripting Fun with fi. In this chapter … Control structures File descriptors Variables.
Guide to Oracle 10g ITBIS373 Database Development Lecture 4a - Chapter 4: Using SQL Queries to Insert, Update, Delete, and View Data.
Some Fortran programming tips ATM 562 Fall 2015 Fovell (see also PDF file on class page) 1.
IBC233 Lecture 2 Updated Winter 2008 Agenda Test next Week – Jan 23 ISeries Architecture CL (Control Language) Library Lists Operations Navigator.
5 1 Data Files CGI/Perl Programming By Diane Zak.
Outline Overview Opening a file How to create a file ? Closing a File Check End-of-file Reading a File Line by Line Reading a File Character by Character.
I Power Higher Computing Software Development High Level Language Constructs.
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
JavaScript, Fourth Edition
Artificial Intelligence Lecture No. 26 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
CSC 212 Object-Oriented Programming and Java Part 2.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
Shell Scripting – Putting it All Together. Agenda Escaping Characters Wildcards Redirecting Output Chaining and Conditional Chaining Unnamed and Named.
DCL Programming Hands-on Session David J Dachtera DJE Systems -
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessor Midterm Review Lecture 7 Feb 17, 2004.
File Systems cs550 Operating Systems David Monismith.
Session Objectives Reserved Words and Object type Conditional Usage of Reserved Words Usage of Conditional Logic 2.
Learners Support Publications Working with Files.
Chapter 6: Looping. Objectives Learn about the loop structure Create while loops Use shortcut arithmetic operators Create for loops Create do…while loops.
Programming Fundamentals. Today’s Lecture Array Fundamentals Arrays as Class Member Data Arrays of Objects C-Strings The Standard C++ string Class.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
1 © 2012 John Urrutia. All rights reserved. Chapter 09 The TC Shell.
1 Week # 5 Agenda CL Programming CL Commands Job Logs Review for test # 1.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
OPERATORS IN C CHAPTER 3. Expressions can be built up from literals, variables and operators. The operators define how the variables and literals in the.
String and Lists Dr. José M. Reyes Álamo. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
String and Lists Dr. José M. Reyes Álamo.
MATLAB: Structures and File I/O
Topics Introduction to File Input and Output
Chapter 7 Files and Exceptions
String and Lists Dr. José M. Reyes Álamo.
Introduction to Computer Science
Topics Introduction to File Input and Output
Presentation transcript:

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 1 Intermediate DCL Programming David J. Dachtera DJE Systems

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 2 Agenda - Review Intro Basic DCL Concepts Commands Verbs Symbols IF-THEN IF-THEN-ENDIF IF-THEN-ELSE-ENDIF Labels, GOTO

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 3 Agenda - Review Intro., Cont’d GOSUB-RETURN Common Lexical Functions F$CVTIME F$GETQUI F$GETSYI F$GETDVI PARAMETERS Batch jobs that reSUBMIT themselves

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 4 Agenda - Intermediate SUBROUTINE - ENDSUBROUTINE CALL subroutine [p1[ p2[…]]] Why CALL instead of GOSUB? More Lexical Functions F$SEARCH F$TRNLNM F$ENVIRONMENT F$PARSE F$ELEMENT

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 5 Agenda - Intermediate, Cont’d F$SEARCHing for files File I/O File Read Loops Using F$ELEMENT to parse input strings F$ELEMENT loops Symbol Substitution Using Apostrophes ( ‘symbol’, “’’symbol’” ) Using Ampersand (&)

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 6 DCL Command Elements $ verb parameter_1 parameter_2 DCL Commands consist of a verb and one or more parameters.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 7 DCL Verbs Internal commands ASSIGN, CALL, DEFINE, GOSUB, GOTO, IF, RETURN, SET, STOP, others… External commands APPEND, BACKUP, COPY, DELETE, PRINT, RENAME, SET, SUBMIT, others...

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 8 DCL Verbs, Cont’d “Foreign” Commands $ symbol = value Examples: $ DIR :== DIRECTORY/SIZE=ALL/DATE $ ZIP :== $ZIP/VMS

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 9 More Foreign Commands The DCL$PATH Logical Name (V6.2 +) Behaves similar to the DOS or UN*X “path”:.COM and.EXE files can be sought by way of DCL$PATH $ DEFINE DCL$PATH MYDISK:[MYDIR.PROGS] DCL$PATH can even be a search list: $ DEFINE DCL$PATH - MYDISK:[MYDIR.COM],MYDISK:[MYDIR.EXE]

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 10 DCL$PATH Caveat Specifying an asterisk (“*”) at the DCL prompt, or an invalid specification which results in DCL seeing an asterisk or other wildcard specification, can produce undesirable results: $ * $ dirdisk:*.txt %DCL-W-NOLBLS, label ignored - use only within command procedures.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 11 DCL$PATH Caveat Determine what might be found via a wildcard specification: $ DIR DCL$PATH:*.COM; $ DIR DCL$PATH:*.EXE;

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 12 DCL$PATH Caveat Avoid wildcard problems: Place a “$.EXE” program and a “$.COM” in the DCL$PATH path. Each should just exit without doing anything. URL: Download, RENAME to.COM and invoke it.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 13 Conditional Statements $ IF condition(s) THEN statement $ IF condition(s) THEN - $ statement $ IFcondition $ THEN $statement(s) $ ELSE $statement(s) $ ENDIF

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 14 Basic Logical Control $ GOTO label. $label: $ GOSUB label. $label: $ statement(s) $ RETURN

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 15 More Internal Subroutines $ CALL subroutine_name[ p1[ p2[...]]]. $subroutine_name: SUBROUTINE $ statement(s) $ EXIT $ ENDSUBROUTINE

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 16 Why CALL? l The CALL statement allows parameters to be passed on the command line. l SUBROUTINEs act like another procedure depth. (Can be useful when you don’t want local symbols to remain when the subroutine completes.)

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 17 Searching for Files F$SEARCH( string_expression ) ddcu:[dir]FILE.TXT ddcu:[*]FILE.TXT ddcu:[dir]*.DAT ddcu:[dir]*.* Use for finding files with/without wild cards.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 18 File Search Loops $ SV_FSP := $LOOP_1: $ FSP = F$SEARCH( P1 ) $ IF FSP.EQS. “” THEN GOTO EXIT_LOOP_1 $ IF SV_FSP.EQS. “” THEN SV_FSP = FSP $ IF FSP.EQS. SV_FSP THEN GOTO EXIT_LOOP_1 $ statement(s) $ SV_FSP = FSP $ GOTO LOOP_1 $EXIT_LOOP_1: To avoid locked loops, check that the filespec. Returned by F$SEARCH() is not the same as the last iteration.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 19 Multiple F$SEARCH Streams To have more than one F$SEARCH() stream, specify a context identifier. Examples: $ vbl1 = F$SEARCH( SRC1, ) $ vbl2 = F$SEARCH( SRC2, )

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 20 File I/O Statements OPEN - Make a file available READ - Get data from a file WRITE - Output data to a file CLOSE - Finish using a file

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 21 File I/O - OPEN $ OPEN logical_name filespec $ OPEN /ERROR=label /READ /WRITE /SHARE={READ|WRITE}

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 22 File I/O - READ $ READ logical_name symbol_name $ READ /DELETE /END_OF_FILE /ERROR /INDEX /KEY /MATCH /NOLOCK /PROMPT /TIME_OUT ! Terminals only

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 23 File I/O - WRITE $ WRITE logical_name symbol_name $ WRITE /ERROR /SYMBOL ! Use for long strings /UPDATE

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 24 File I/O - CLOSE $ CLOSE logical_name $ CLOSE /ERROR /LOG

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 25 File I/O - READ Loops $ OPEN/READ INFLE MYFILE.DAT $READ_LOOP: $ READ/END=EOF_INFLE INFLE P9 $ statement(s) $ GOTO READ_LOOP $EOF_INFLE:

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 26 Parse - F$ELEMENT() $ vbl = F$ELEMENT( index, delim, string ) index - an integer value delim - the delimiter character string - the string to parse F$ELEMENT() returns the delimiter character when no more elements exist. Example: $ ELEM = F$ELEMENT( 0, “,”, P1 )

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 27 String Parsing Loops $ CNTR = 0 $LOOP_1: $ ELEM = F$ELEM( CNTR, “,” P1 ) $ CNTR = CNTR + 1 $ IF ELEM.EQS. “” THEN GOTO LOOP_1 $ IF ELEM.EQS. “,” THEN GOTO EXIT_LOOP_1 $ statement(s) $ GOTO LOOP_1 $EXIT_LOOP_1:

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 28 Symbol Substitution Two forms of symbol substitution: &symbol_name ‘symbol_name’ or “’’symbol_name’”

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 29 Symbol Substitution Order of Substitution: 1. Ampersand(&) 2. Apostrophe(‘)

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 30 Symbol Substitution Use order of substitution to your advantage: $ SYMB := ‘PREFIX’SYMBOL $ vbl = &SYMB

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 31 Symbol Substitution Command line length limits: Before symbol substitution: 255 bytes After symbol substitution: 1024 bytes

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 32 Symbol “Scope” Determine symbol scope for the current procedure depth: $ SET SYMBOL/SCOPE=(keyword(s)) - [NO]LOCAL - [NO]GLOBAL Can help prevent problems due to symbols defined locally at another procedure depth or globally.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 33 Symbol “Scope” $ SET SYMBOL/SCOPE=(keyword(s)) Other Qualifiers: /ALL, /VERB and /GENERAL /VERB applies only to the first “token” on a command line. /GENERAL applies to all other “tokens” on a command line. /ALL applies to both.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 34 String Operations Concatenation: $ vbl = string1 + string2 Example: $ PROC = F$ENVIRONMENT( “PROCEDURE” ) $ DEVC = F$PARSE( PROC,,, “DEVICE” ) $ DRCT = F$PARSE( PROC,,, “DIRECTORY” ) $ FLOC = DEVC + DRCT

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 35 String Operations Reduction: $ vbl = string - substring Example: $ DVN = F$GETDVI( “SYS$DISK”, “ALLDEVNAM” ) $ DNM = DVN - “_” - “:” $ SHOW SYMBOL DNM DNM = “DJVS01$DKA0”

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 36 String Operations Substring Replacement: $ vbl[start,length] = string Example: $ nam := hydrichlor $ nam[4,1] := o $ show symbol nam NAM = “HYDROCHLOR”

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 37 String Operations Binary Assignment: $ vbl[start_bit,bit_count] = integer Examples: $ CR[0,8] = 13 $ LF[0,8] = 10 $ ESC[0,8]= 27 $ CSI[0,8]= 155

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 38 DCL “Arrays” DCL does not support arrays in the usual sense. However, you can use a counter within a loop to create a list of variables: $ CNTR = 0 $LOOP: $ CNTR = CNTR + 1 $ FIELD_’CNTR’ = vbl $ IF CNTR.LE. 12 THEN - $ GOTO LOOP

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 39 Integer Operations DCL supports the four basic arithmetic operations: +Add -Subtract *Multiply /Divide

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 40 Boolean Operations DCL supports assignment of boolean values: $ vbl = (condition) Examples: $ TRUE = (1.EQ. 1) $ FALSE = (1.EQ. 0)

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 41 Logical Operations DCL supports logical AND, OR and NOT $ vbl = (int1.AND. int2) $ vbl = (int1.OR. int2) $ vbl = (.NOT. int3) Examples: $ STATUS = &$STATUS $ SEVERITY = (STATUS.AND. 7) $ FAILURE = (.NOT. (SEVERITY.AND. 1)) $ EXIT_STATUS = (STATUS.OR. %X )

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 42 Error Trapping Using the “ON” statement, you can set multiple levels of error trapping: $ ON WARNING THEN statement $ ON ERROR THEN statement $ ON SEVERE_ERROR THEN statement $ ON CONTROL_Y THEN statement Turn error trapping off or on: $ SET NOON $ SET ON

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 43 Handling Errors $ SET NOON $ statement $ STATUS = &$STATUS $ SEVERITY = (STATUS.AND. 7) $ IF SEVERITY.EQ. 0 THEN - $ GOSUB ANNOUNCE_WARNING $ IF SEVERITY.EQ. 2 THEN - $ GOSUB ANNOUNCE_ERROR $ IF SEVERITY.EQ. 4 THEN - $ GOSUB ANNOUNCE_FATALERROR

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 44 Lexical - F$TRNLNM Use to translate logical names. $ vbl = F$TRNLNM( - logical_name,- table_name,- index,- mode,- case,- item ) Does NOT support wildcard look-ups!

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 45 Lexical - F$ENVIRONMENT Get information about the process environment. $ vbl = F$ENVIRONMENT( keyword ) Some useful keywords: CAPTIVE“TRUE” or “FALSE” DEFAULTCurrent default ddcu:[dir] MESSAGEQualifier string PROCEDUREFully qualified filespec. Others...

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 46 Lexical - F$ENVIRONMENT A useful example: $ DFLT = F$ENVIRONMENT( “DEFAULT” ) $ MSG = F$ENVIRONMENT( “MESSAGE” ) $ SET DEFAULT ddcu:[dir] $ SET MESSAGE/NOFACI/NOSEVE/NOIDE/NOTEXT $ statement(s) $ SET MESSAGE’MSG’ $ SET DEFAULT &DFLT

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 47 Lexical - F$PARSE Use to verify or extract portions of a file specification. $ vbl = F$PARSE( - filespec,- default_spec,- related_spec,- field,- parse_type)

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 48 Lexical - F$PARSE A useful example: $ DFSP = F$ENVIRONMENT( “DEFAULT” ) + “.COM” $ FSP = F$PARSE( “LOGIN”, DFSP ) $ SHOW SYMBOL FSP “FSP” = “MYDISK:[MYDIR]LOGIN.COM;”

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 49 Lexical - F$PARSE Another useful example: $ PROC = F$ENVIRONMENT( “PROCEDURE” ) $ DEVC = F$PARSE( PROC,,, “DEVICE” ) $ DRCT = F$PARSE( PROC,,, “DIRECTORY” ) $ DFLT = F$ENVIRONMENT( “DEFAULT” ) $ FLOC = DEVC + DRCT $ SET DEFAULT &FLOC $ statement(s) $ SET DEFAULT &DFLT

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 50 Lexical - F$GETQUI Get information about queues and jobs on them. $ vbl = F$GETQUI( - function,- item,- object_identifier,- flags ) Can be complicated, is definitely useful.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 51 Lexical - F$GETQUI Functions: CANCEL_OPERATION DISPLAY_ENTRY DISPLAY_FILE DISPLAY_FORM DISPLAY_JOB DISPLAY_MANAGER DISPLAY_QUEUE TRANSLATE_QUEUE

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 52 Lexical - F$GETQUI Some useful items: AFTER_TIME FILE_SPECIFICATION ENTRY_NUMBER JOB_NAME QUEUE_NAME QUEUE_PAUSED QUEUE_STOPPED There’s LOTS more item codes!

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 53 Lexical - F$GETQUI Typical usage: 1. Use DISPLAY_QUEUE to establish a queue context (object=“*”) 2. Use DISPLAY_JOB to display jobs on the queue (object=“*”). 3. Loop back to #2 until no more jobs. 4. Loop back to #1 until a null queue name is returned.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 54 Lexical - F$GETQUI To retrieve multiple items about a queue or a job, use the FREEZE_CONTEXT flag on all but the last F$GETQUI for that item. Example: $ QN = F$GETQUI( “DISPLAY_QUEUE”,”QUEUE_NAME”,- “*”, “FREEZE_CONTEXT” ) $ NN = F$GETQUI( “DISPLAY_QUEUE”,- ”SCSNODE_NAME”, “*”,)

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 55 Lexical - F$CVTIME Most useful for adding and subtracting days, hours, minutes and/or seconds to/from a date. Examples: $ NEXT_WEEK = F$CVTIME(“+7-”, “ABSOLUTE”,) $ MONTH_END = (F$CVTIME(“+1-”,, “DAY”).EQ. 1) $ YEAR_END = (MONTH_END.AND. - (F$CVTIME(“+1-”,, “MONTH”).EQ. 1)) $ NOW = F$CVTIME(,, “TIME” ) $ LATER = F$CVTIME(,, “TIME” ) $ ELAPSED_TIME = - F$CVTIME( “’’LATER’-’’NOW’,, “TIME” )

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 56 Lexical - F$EXTRACT Use to extract substrings. $ vbl = F$EXTRACT( - offset,-! Zero relative! length,- string ) Note: The offset is “zero-relative”; i.e., starts at zero(0).

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 57 Lexical - F$GETDVI Use to get information about devices. $ vbl = F$GETDVI( “ddcu:”, item ) Some useful items: ALLDEVNAM FREEBLOCKS LOGVOLNAM MAXBLOCK TT_ACCPORNAM Many others…

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 58 Lexical - F$EDIT Use to modify strings. $ vbl = F$EDIT( string, keyword(s) ) Keywords: COLLAPSE COMPRESS LOWERCASE TRIM UNCOMMENT UPCASE

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 59 Lexical - F$GETJPI Use to get information about your process or process tree. $ vbl = F$GETJPI( pid, item ) To get info. about the current process, specify PID as null (“”) or zero(0). Example: $ MODE = F$GETJPI( 0, “MODE” )

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 60 Lexical - F$GETJPI Some useful items: IMAGNAME MASTER_PID MODE PID PRCNAM USERNAME WSSIZE

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 61 Lexical - F$GETJPI A note of caution: The AUTHPRIV and CURPRIV items can return strings which are too long to manipulate.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 62 Lexical - F$GETSYI Use to get information about the system. $ vbl = F$GETSYI( item[,nodename][,cluster_id] ) Can be used to retrieve the value of any system parameter, as well as values associated with some other keywords (see HELP or the DCL Dictionary). Some useful items: CLUSTER_MEMBERHW_NAME CLUSTER_ FTIME NODENAME CLUSTER_ NODES

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 63 F$CONTEXT and F$PID Use to locate selected processes. Use F$CONTEXT to set up selection criteria. Use F$PID to locate selected processes.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 64 F$CONTEXT and F$PID Use F$CONTEXT to set up selection criteria. $ TMP = F$CONTEXT( “PROCESS”, - CTX, “MODE”, “INTERACTIVE”, “EQL” ) $ TMP = F$CONTEXT( “PROCESS”, - CTX, “NODE”, “*”, “EQL” ) Selection criteria are cumulative.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 65 F$CONTEXT and F$PID Use F$PID to locate selected processes. $LOOP: $ PID = F$PID( CTX ) $ IF PID.EQS. “” THEN GOTO EXIT_LOOP $ statement(s) $ GOTO LOOP $EXIT_LOOP: $ IF F$TYPE( CTX ).EQS. “PROCESS_CONTEXT” THEN - $ TMP = F$CONTEXT( “PROCESS”, CTX, “CANCEL” )

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 66 Other Lexical Functions Lexicals A set of functions that return information about character strings and attributes of the current process. Additional information available: F$CONTEXT F$CSID F$CVSI F$CVTIME F$CVUI F$DEVICE F$DIRECTORY F$EDIT F$ELEMENT F$ENVIRONMENT F$EXTRACT F$FAO F$FILE_ATTRIBUTES F$GETDVI F$GETJPI F$GETQUI F$GETSYI F$IDENTIFIER F$INTEGER F$LENGTH F$LOCATE F$MESSAGE F$MODE F$PARSE F$PID F$PRIVILEGE F$PROCESS F$SEARCH F$SETPRV F$STRING F$TIME F$TRNLNM F$TYPE F$USER F$VERIFY

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 67 Q & A Speak now or forever hold your peas.

DJE Systems©1999 All Rights ReservedIntermediate DCL Programming DECUS Symposium - Fall 1999 San DiegoSlide 68 Thank You! Remember to fill out the evaluation forms!