18.08.2013 Views

(SYSLIB) Programming Reference Manual - Public Support Login ...

(SYSLIB) Programming Reference Manual - Public Support Login ...

(SYSLIB) Programming Reference Manual - Public Support Login ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

OS 2200<br />

System Service Routines Library<br />

(<strong>SYSLIB</strong>)<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong><br />

û 2001 Unisys Corporation.<br />

All rights reserved.<br />

ClearPath OS 2200 Release 7.0<br />

Printed in USA<br />

November 2001 7833 1733–004<br />

UNISYS


NO WARRANTIES OF ANY NATURE ARE EXTENDED BY THIS DOCUMENT. Any product or related information<br />

described herein is only furnished pursuant and subject to the terms and conditions of a duly executed agreement to<br />

purchase or lease equipment or to license software. The only warranties made by Unisys, if any, with respect to the<br />

products described in this document are set forth in such agreement. Unisys cannot accept any financial or other<br />

responsibility that may be the result of your use of the information in this document or software material, including<br />

direct, special, or consequential damages.<br />

You should be very careful to ensure that the use of this information and/or software material complies with the laws,<br />

rules, and regulations of the jurisdictions with respect to which it is used.<br />

The information contained herein is subject to change without notice. Revisions may be issued to advise of such<br />

changes and/or additions.<br />

Notice to Government End Users: The software and accompanying documentation are delivered and licensed as<br />

“commercial computer software” and “commercial computer software documentation” as those terms are used in 48<br />

C.F.R. § 12.212 and 48 C.F.R. § 227.7202-1 through 227.7202-4, as applicable. The Government shall receive only those<br />

rights provided in the standard commercial software license, or where applicable, the restricted and limited rights<br />

provisions of the contract FAR or DFARS (or equivalent agency) clause.<br />

Correspondence regarding this publication can be e-mailed to doc@unisys.com.<br />

Unisys and ClearPath are registered trademarks of Unisys Corporation.<br />

All other marks are acknowledged to be the trademarks or registered trademarks of their respective owners. Unisys<br />

Corporation cannot attest to the accuracy of this information.


OS 2200<br />

System Service Routines<br />

Library (<strong>SYSLIB</strong>)<br />

<strong>Programming</strong> <strong>Reference</strong><br />

<strong>Manual</strong><br />

ClearPath OS 2200<br />

Release 7.0<br />

OS 2200<br />

System Service<br />

Routines Library<br />

(<strong>SYSLIB</strong>)<br />

<strong>Programming</strong><br />

<strong>Reference</strong><br />

<strong>Manual</strong><br />

ClearPath OS 2200<br />

Release 7.0<br />

7833 1733–004 7833 1733–004<br />

Bend here, peel upwards and apply to spine.


Contents<br />

Section 1. Introduction.......................................................................1–1<br />

1.1. About This <strong>Manual</strong> ................................................................... 1–1<br />

1.2. Notation Conventions............................................................... 1–2<br />

1.3. About <strong>SYSLIB</strong>........................................................................... 1–4<br />

Section 2. System Standard Procedures and Definitions ...................2–1<br />

2.1. Common Bank Entry Points ..................................................... 2–1<br />

2.2. MAXR$–Register and Partial-Word Definitions........................ 2–2<br />

2.3. PROC$–System Procedures .................................................... 2–4<br />

2.4. SSTYP$–Element Subtypes ..................................................... 2–4<br />

2.5. ASUBTYP$–Executable Element Subtypes and Subsubtypes...............................................................................<br />

2–7<br />

2.6. SYS$DEF–System Definitions.................................................. 2–8<br />

2.7. <strong>SYSLIB</strong>$ID–<strong>SYSLIB</strong> Identification ............................................ 2–9<br />

Section 3. <strong>SYSLIB</strong> Access Methods ....................................................3–1<br />

3.1. Relocatable Collection Method ................................................ 3–2<br />

3.2. Common Bank Call Using I$BJ ................................................ 3–3<br />

3.3. Common Bank Call Using Auto Switch Method ...................... 3–5<br />

Section 4. AEDIT$–ASCII Image Composition Editing Package..........4–1<br />

4.1. Packet....................................................................................... 4–2<br />

4.1.1. Packet Format.................................................................. 4–3<br />

4.1.2. Packet Generation PROC ................................................ 4–4<br />

4.1.3. Examples ......................................................................... 4–5<br />

4.2. Calling Sequence...................................................................... 4–6<br />

4.2.1. General-Purpose Editing Routines................................... 4–7<br />

4.2.2. Floating-Point Editing Routines...................................... 4–14<br />

4.2.2.1. Calling Procedures for the Floating-Point<br />

Editing Routines ............................................... 4–16<br />

4.2.2.2. Example ................................................................ 4–17<br />

4.2.3. Time and Date Editing Routines .................................... 4–18<br />

4.2.4. Standard Format Date and Time Editing Routines ........ 4–19<br />

4.2.4.1. Recommended Date and Time Formats............... 4–21<br />

4.2.4.2. Calling Procedure for Date and Time Editing........ 4–21<br />

4.2.4.3. Example ................................................................ 4–23<br />

7833 1733–004 iii


Contents<br />

4.2.5. Error Status Codes ........................................................ 4–24<br />

4.2.6. Examples....................................................................... 4–25<br />

Section 5. BSP$–Program File Basic Service Package ....................... 5–1<br />

5.1. BSP$ Functions........................................................................ 5–3<br />

5.1.1. Read FTI .......................................................................... 5–3<br />

5.1.2. Read Program File Table ................................................. 5–9<br />

5.1.3. Search Table for Requested Item ................................. 5–11<br />

5.1.4. Delete Item from Requested Table............................... 5–14<br />

5.1.5. Entry Look-Up by Number............................................. 5–18<br />

5.1.6. Change Item in Requested Table.................................. 5–21<br />

5.1.7. Add Item to Requested Table ....................................... 5–23<br />

5.1.8. Write Last Item <strong>Reference</strong>d.......................................... 5–29<br />

5.1.9. Mark Item as Updated................................................... 5–30<br />

5.1.10. Write Requested Table Back to Mass Storage ............. 5–32<br />

5.1.11. Write FTI........................................................................ 5–33<br />

5.2. Example of Using BSP$ ......................................................... 5–34<br />

5.3. LEPF Considerations.............................................................. 5–35<br />

Section 6. CABSAD$, CRELAD$–Addressing Routines ...................... 6–1<br />

6.1. Absolute Addressing Routines................................................. 6–1<br />

6.1.1. CABSAD$–Compute Absolute Address.......................... 6–2<br />

6.1.2. CAINIT$–Initialize CABSAD$........................................... 6–4<br />

6.1.3. CBX$–Compute Bank Descriptor Index .......................... 6–5<br />

6.1.4. CSX$–Compute Segment Index ..................................... 6–6<br />

6.1.5. CSYMVL$–Compute Symbol Value ................................ 6–7<br />

6.2. Relocatable Addressing Routines ............................................ 6–8<br />

6.2.1. CRELAD$–Compute Relative Address............................ 6–9<br />

6.2.2. CRINIT$–Initialize CRELAD$ ......................................... 6–12<br />

6.2.3. CBN$–Convert BDI to Symbolic Bank Name................ 6–13<br />

6.2.4. CSN$–Convert Segment Index to Segment<br />

Name......................................................................... 6–14<br />

Section 7. CONWRD$–Condition Word Routine ................................. 7–1<br />

7.1. MASM Interface ...................................................................... 7–1<br />

7.2. PLUS Interface......................................................................... 7–3<br />

Section 8. EDIT$–Fieldata Image Composition Editing Package........ 8–1<br />

8.1. EDIT$–Packet Format .............................................................. 8–2<br />

8.2. EDIT$–General-Purpose Editing Routines ............................... 8–5<br />

8.3. EDIT$T–Time and Date Editing Routines................................. 8–8<br />

8.4. EDIT$F–Floating-Point Editing Routines .................................. 8–9<br />

iv 7833 1733–004


Contents<br />

Section 9. FDASC$–Fieldata/ASCII Data Conversion ..........................9–1<br />

9.1. MASM Interface....................................................................... 9–1<br />

9.1.1. Fieldata to ASCII Conversion........................................... 9–1<br />

9.1.2. ASCII to Fieldata Conversion........................................... 9–3<br />

9.2. TABLE$–Fieldata/ASCII Conversion Table ............................... 9–3<br />

Section 10. GETPSF$–Get a Scratch File Routine ...............................10–1<br />

10.1. File Assignment...................................................................... 10–1<br />

10.2. MASM Interface..................................................................... 10–2<br />

10.2.1. Packet............................................................................ 10–2<br />

10.2.2. Calling Sequence ........................................................... 10–2<br />

Section 11. ID$–Identification Line Routine .......................................11–1<br />

11.1. MASM Interface..................................................................... 11–2<br />

11.1.1. Packet............................................................................ 11–2<br />

11.1.2. Calling Sequence ........................................................... 11–5<br />

11.1.3. Examples ....................................................................... 11–7<br />

11.2. PLUS Interface ....................................................................... 11–8<br />

11.2.1. Packet............................................................................ 11–8<br />

11.2.2. Calling Sequence ........................................................... 11–8<br />

11.2.3. Example ....................................................................... 11–11<br />

11.3. Packet Format ...................................................................... 11–12<br />

Section 12. INFOR$–Internal Format Table Interface Routines ...........12–1<br />

12.1. Format of the Internal Format Table ...................................... 12–2<br />

12.2. General Considerations for Using the INFOR Routines ......... 12–2<br />

12.3. INFOR$–Routines................................................................... 12–3<br />

12.3.1. RINF$–Read INFOR Table ............................................. 12–4<br />

12.3.2. SINF$–Search INFOR Table........................................... 12–6<br />

12.3.3. SELT$–Transfer to ELT$ Table from INFOR Table........ 12–8<br />

12.3.4. DUSE$–Assign a USE Name to the File in ELT$......... 12–11<br />

Section 13. MFDSP$–Master File Directory Service Package .............13–1<br />

13.1. Packet..................................................................................... 13–1<br />

13.2. Calling Sequence.................................................................... 13–2<br />

13.3. Error Conditions...................................................................... 13–5<br />

13.4. Examples................................................................................ 13–9<br />

Section 14. PREPRM, PREPRO, PREPF$, and POSTPR$......................14–1<br />

14.1. PREPRO, PREPRM–Preprocessor Routines.......................... 14–1<br />

14.1.1. PREPRO–Preprocessor Routine .................................... 14–2<br />

14.1.2. PREPRM–Preprocessor Routine ................................... 14–3<br />

14.1.3. PARTBL Description ...................................................... 14–5<br />

7833 1733–004 v


Contents<br />

14.1.4. Reusable Processor Construction ................................. 14–7<br />

14.1.4.1. REPRO$–Reusable Processor Preprocessor<br />

Routine ............................................................. 14–8<br />

14.1.4.2. REPRM$–Reusable Processor<br />

Preprocessor Routine....................................... 14–9<br />

14.1.5. FLDGET–Processor Field Retrieval ............................. 14–10<br />

14.2. PREPF$–Preprocessor Routine............................................ 14–12<br />

14.3. POSTPR$–Postprocessor Routine....................................... 14–14<br />

14.4. FLDREL$–Field Release....................................................... 14–14<br />

Section 15. ROR, ROR$–Relocatable Output Routine......................... 15–1<br />

15.1. SROR$, SROR$EB–Start Relocatable Output<br />

Routine .............................................................................. 15–1<br />

15.2. ROR$, ROR$EB–Generation of Relocatable<br />

Output................................................................................ 15–2<br />

15.3. EROR$, EROR$EB–End Relocatable Output<br />

Routine .............................................................................. 15–6<br />

15.4. TBLWR$, TBLWR$EB–Write Table to File ............................ 15–6<br />

15.5. Optimization Information ....................................................... 15–7<br />

Section 16. SAR$–Symbolic Access Routines.................................... 16–1<br />

16.1. File Information Packet .......................................................... 16–2<br />

16.1.1. PLUS Interface .............................................................. 16–2<br />

16.1.1.1. FIP Field Descriptions........................................... 16–2<br />

16.1.1.2. READ and WRITE Field Requirements................. 16–6<br />

16.1.2. MASM Interface............................................................ 16–7<br />

16.1.2.1. FIP Field Descriptions........................................... 16–7<br />

16.1.2.2. READ and WRITE Field Requirements............... 16–11<br />

16.2. SAR$ Internal Format........................................................... 16–12<br />

Section 17. SAR$ READ..................................................................... 17–1<br />

17.1. READ Function/PLUS Interface ............................................. 17–1<br />

17.1.1. READ Packet Data Structure Description ..................... 17–1<br />

17.1.1.1. Required Information for READ Procedures ........ 17–2<br />

17.1.1.2. Optional Information for READ Procedures ......... 17–3<br />

17.1.1.3. Information Returned by READ Procedures......... 17–6<br />

17.1.2. Buffers and Tables for PLUS READ Procedures......... 17–10<br />

17.1.3. READ Procedures Called from PLUS .......................... 17–12<br />

17.1.3.1. SAR_OPEN_INPUT Procedure Call .................... 17–13<br />

17.1.3.2. SAR_READ Procedure Call ................................. 17–14<br />

17.1.3.3. SAR_CLOSE_INPUT Procedure Call................... 17–15<br />

17.1.3.4. Example .............................................................. 17–16<br />

17.1.4. Status Lists for PLUS READ Procedures .................... 17–17<br />

17.2. READ Function/MASM Interface......................................... 17–20<br />

17.2.1. READ Packet and Data Area Description .................... 17–20<br />

17.2.1.1. Required Information for READ Procedures ...... 17–20<br />

17.2.1.2. Optional Information for READ Procedures ....... 17–21<br />

vi 7833 1733–004


Contents<br />

17.2.1.3. Information Returned by READ Procedures....... 17–23<br />

17.2.1.4. READ Packet Definition PROC ........................... 17–26<br />

17.2.2. Buffers and Tables for MASM READ Procedures....... 17–27<br />

17.2.3. READ Procedures Called from MASM........................ 17–27<br />

17.2.3.1. Open-Input Procedure Call (S$AROPENI)........... 17–28<br />

17.2.3.2. Read Procedure Call (S$ARREAD)...................... 17–29<br />

17.2.3.3. Close-Input Procedure Call (S$ARCLOSI)........... 17–30<br />

17.2.4. Status Lists for MASM READ Procedures .................. 17–30<br />

17.3. <strong>Support</strong>ed Character Set Types for the READ Function ...... 17–33<br />

17.3.1. Fieldata ........................................................................ 17–33<br />

17.3.2. ASCII/ISO and ASCII-like ............................................. 17–33<br />

17.3.3. ASCII/ISO with Embedded Shift-Coded Kanji.............. 17–34<br />

17.3.4. Attributed Character Data............................................ 17–34<br />

Section 18. SAR$ WRITE.....................................................................18–1<br />

18.1. WRITE Function/PLUS Interface ............................................ 18–1<br />

18.1.1. WRITE Packet Data Structure Description .................... 18–1<br />

18.1.1.1. Required Information for WRITE<br />

Procedures........................................................ 18–2<br />

18.1.1.2. Optional Information for WRITE Procedures ........ 18–4<br />

18.1.1.3. Information Returned by WRITE<br />

Procedures........................................................ 18–9<br />

18.1.2. Buffers and Tables for PLUS WRITE Procedures........ 18–10<br />

18.1.3. WRITE Procedures Called from PLUS......................... 18–12<br />

18.1.3.1. SAR_OPEN_OUTPUT Procedure Call ................. 18–13<br />

18.1.3.2. SAR_WRITE Procedure Call................................ 18–14<br />

18.1.3.3. SAR_WRITE_CONTROL Procedure Call............. 18–15<br />

18.1.3.4. SAR_CLOSE_OUTPUT Procedure Call ............... 18–17<br />

18.1.3.5. Example .............................................................. 18–18<br />

18.1.4. Status Lists for PLUS WRITE Procedures................... 18–19<br />

18.2. WRITE Function/MASM Interface........................................ 18–21<br />

18.2.1. WRITE Packet and Data Area Description................... 18–22<br />

18.2.1.1. Required Information for WRITE<br />

Procedures...................................................... 18–22<br />

18.2.1.2. Optional Information for WRITE Procedures ...... 18–23<br />

18.2.1.3. Information Returned by WRITE<br />

Procedures...................................................... 18–27<br />

18.2.1.4. WRITE Packet Definition PROC.......................... 18–28<br />

18.2.2. MASM WRITE Procedures Buffers and Tables........... 18–29<br />

18.2.3. WRITE Procedures Called from MASM ...................... 18–29<br />

18.2.3.1. Open-Output Procedure Call (S$AROPENO)...... 18–29<br />

18.2.3.2. WRITE Procedure Call (S$ARWRITE) ................. 18–30<br />

18.2.3.3. Close-Output Procedure Call (S$ARCLOSO) ...... 18–31<br />

18.2.4. Status Lists for MASM WRITE Procedures ................ 18–32<br />

18.3. WRITE Function <strong>Support</strong>ed Character Set Types ................ 18–34<br />

18.3.1. ASCII/ISO and ASCII-like ............................................. 18–35<br />

18.3.2. ASCII/ISO with Embedded Shift-Coded Kanji.............. 18–35<br />

18.3.3. Attributed Character Data............................................ 18–35<br />

7833 1733–004 vii


Contents<br />

Section 19. SAR$ ATREAD ................................................................ 19–1<br />

19.1. ATREAD Function/PLUS Interface......................................... 19–1<br />

19.1.1. ATREAD Packet Data Structure Description................. 19–1<br />

19.1.1.1. Required Information for ATREAD<br />

Procedures ....................................................... 19–2<br />

19.1.1.2. Optional Information for ATREAD<br />

Procedures ....................................................... 19–3<br />

19.1.1.3. Information Returned by ATREAD<br />

Procedures ....................................................... 19–5<br />

19.1.2. PLUS ATREAD Procedures Buffers and Tables............ 19–7<br />

19.1.3. ATREAD Procedures Called from PLUS........................ 19–8<br />

19.1.3.1. SAR_INITIALIZE_ATREAD Procedure Call ........... 19–8<br />

19.1.3.2. SAR_ATREAD Procedure Call............................... 19–9<br />

19.1.4. SAR_RESTORE_ATREAD Procedure Call ................... 19–11<br />

19.1.5. Status Lists for PLUS ATREAD Procedures................ 19–11<br />

19.2. ATREAD Function/MASM Interface .................................... 19–13<br />

19.2.1. ATREAD Packet and Data Area Description................ 19–13<br />

19.2.1.1. Required Information for ATREAD<br />

Procedures ..................................................... 19–13<br />

19.2.1.2. Optional Information for ATREAD<br />

Procedures ..................................................... 19–14<br />

19.2.1.3. Information Returned by ATREAD<br />

Procedures ..................................................... 19–16<br />

19.2.1.4. ATREAD Packet Definition PROC<br />

(S$ARATRDEF)............................................... 19–17<br />

19.2.1.5. ATREAD Packet Generation PROC<br />

(S$ARATRPKT) ............................................... 19–18<br />

19.2.2. MASM ATREAD Procedures Buffers and Tables ....... 19–19<br />

19.2.3. ATREAD Procedures Called from MASM ................... 19–19<br />

19.2.3.1. Initialize ATREAD Procedure Call<br />

(S$ARINITATR) ............................................... 19–19<br />

19.2.3.2. ATREAD Procedure Call (S$ARATREAD) ........... 19–20<br />

19.2.3.3. Reset ATREAD Procedure Call<br />

(S$ARRSATR) ................................................. 19–22<br />

19.2.4. Status Lists for MASM ATREAD Procedures ............. 19–23<br />

Section 20. SAR$ COM ...................................................................... 20–1<br />

20.1. SAR$ COM Function/PLUS Interface .................................... 20–1<br />

20.1.1. SAR$ COM Packet Data Structure Description ............ 20–1<br />

20.1.1.1. Required Information for SAR$ COM<br />

Procedure ......................................................... 20–1<br />

20.1.1.2. Optional Information for SAR$ COM<br />

Procedure ......................................................... 20–2<br />

20.1.1.3. Information Returned by SAR$ COM<br />

Procedure ......................................................... 20–6<br />

20.1.2. SAR$ PLUS COM Procedure Buffers and Tables ......... 20–7<br />

20.1.3. SAR$ COM Procedure Called from PLUS..................... 20–8<br />

20.1.4. Status Lists for PLUS COM Procedure ......................... 20–9<br />

20.2. SAR$ COM Function/MASM Interface................................ 20–11<br />

viii 7833 1733–004


Contents<br />

20.2.1. SAR$ COM Packet and Data Area Description ........... 20–11<br />

20.2.1.1. Required Information for SAR$ COM<br />

Procedure ....................................................... 20–11<br />

20.2.1.2. Optional Information for SAR$ COM<br />

Procedure ....................................................... 20–12<br />

20.2.1.3. Information Returned by COM Procedure.......... 20–14<br />

20.2.1.4. COM Packet Definition PROC<br />

(S$ARCOMDEF) ............................................. 20–15<br />

20.2.1.5. SAR$ COM Packet Generation PROC<br />

(S$ARCOMPKT).............................................. 20–16<br />

20.2.2. MASM SAR$ COM Procedure Buffers and<br />

Tables ...................................................................... 20–17<br />

20.2.3. SAR$ MASM COM Procedure Call (S$ARCOM)......... 20–17<br />

20.2.4. Status Lists for the MASM COM Procedure............... 20–19<br />

Section 21. SDFI, SDFO–System Data Format I/O Routines ................21–1<br />

21.1. SDFI–System Data Format Input Routine .............................. 21–2<br />

21.1.1. Packet............................................................................ 21–2<br />

21.1.1.1. Packet Format....................................................... 21–3<br />

21.1.1.2. Packet Generation PROC...................................... 21–4<br />

21.1.2. Calling Sequence ........................................................... 21–7<br />

21.1.2.1. Open SDFI ............................................................ 21–7<br />

21.1.2.2. Read an Image ...................................................... 21–8<br />

21.1.2.3. Close SDFI .......................................................... 21–10<br />

21.2. SDFO–System Data Format Output Routine ....................... 21–10<br />

21.2.1. Packet.......................................................................... 21–10<br />

21.2.1.1. Packet Format..................................................... 21–11<br />

21.2.1.2. Packet Generation PROC.................................... 21–13<br />

21.2.2. Calling Sequence ......................................................... 21–16<br />

21.2.2.1. Open SDFO......................................................... 21–16<br />

21.2.2.2. Write an Image ................................................... 21–17<br />

21.2.2.3. Close SDFO ........................................................ 21–17<br />

21.3. Error Return.......................................................................... 21–18<br />

Section 22. SFDT$–System Standard Format Date and Time .............22–1<br />

22.1. MASM Interface..................................................................... 22–3<br />

22.1.1. Packet............................................................................ 22–3<br />

22.1.2. Calling Sequence ........................................................... 22–5<br />

22.1.3. Example ......................................................................... 22–7<br />

22.2. PLUS Interface ....................................................................... 22–8<br />

22.2.1. Packet............................................................................ 22–8<br />

22.2.2. Calling Sequence ......................................................... 22–11<br />

22.2.3. Example ....................................................................... 22–12<br />

22.3. SFDTBL$–Month and Day Table .......................................... 22–12<br />

7833 1733–004 ix


Contents<br />

Section 23. SIR$–Symbolic Input/Output Routine.............................. 23–1<br />

23.1. SIR$–Control Options ............................................................ 23–6<br />

23.2. SIR$ Entry Points ................................................................. 23–10<br />

23.2.1. OPNSR$–Open SIR$ Input and Output....................... 23–10<br />

23.2.2. INISR$–Initialize SIR$ Input and Output...................... 23–11<br />

23.2.3. GETAS$–Get Symbolic Image in ASCII....................... 23–13<br />

23.2.4. GETSR$–Get Symbolic Image in Fieldata ................... 23–16<br />

23.2.5. GETNM$–Get Symbolic Image Without<br />

Translation............................................................... 23–18<br />

23.2.6. CLOSR$–Close SIR$ Input and Output....................... 23–19<br />

23.3. External Labels..................................................................... 23–20<br />

23.4. SIR$–Multipass Capability.................................................... 23–20<br />

23.5. Compressed Symbolic Elements......................................... 23–20<br />

Section 24. Program Trace Routine ................................................... 24–1<br />

24.1. Calling Sequence ................................................................... 24–3<br />

24.2. Terminating Trace .................................................................. 24–3<br />

24.3. Symbol Tables........................................................................ 24–4<br />

24.4. Demand Mode Operation ...................................................... 24–5<br />

24.4.1. Contingency Processing................................................ 24–7<br />

24.4.2. Demand Mode Commands........................................... 24–8<br />

24.5. Control Flags ........................................................................ 24–18<br />

Section 25. SOR–Symbolic Output Routine ....................................... 25–1<br />

25.1. SSOR$–Start Symbolic Output .............................................. 25–2<br />

25.2. SORASC$ and SORASCA$–Output ASCII Image.................. 25–3<br />

25.3. Output Fieldata Image ........................................................... 25–4<br />

25.4. SORNM$ and SORNMA$–Output Specified Coded<br />

Character Set Image.......................................................... 25–5<br />

25.5. ESOR$–End Symbolic Output................................................ 25–6<br />

25.6. SOR File Control Table (SORFCT$)........................................ 25–6<br />

Appendix A. Using <strong>SYSLIB</strong> ....................................................................A–1<br />

A.1. Efficient Collections .................................................................A–1<br />

A.2. PLUS Routines.........................................................................A–1<br />

A.3. Compilations ............................................................................A–1<br />

Appendix B. Diagnostic Messages ........................................................ B–1<br />

B.1. Processor Interface Routine Messages...................................B–1<br />

B.2. SIR$–Line-Change Diagnostics................................................B–4<br />

x 7833 1733–004


Contents<br />

Appendix C. <strong>SYSLIB</strong> Restrictions .......................................................... C–1<br />

C.1. ASM Compatibility....................................................................C–1<br />

C.2. Object Modules........................................................................C–1<br />

C.3. SDFI and SDFO Tape Handling ................................................C–1<br />

C.4. Symbolic Access Routine (SAR$).............................................C–1<br />

C.5. 65K Addressing Limit ...............................................................C–1<br />

Appendix D. <strong>SYSLIB</strong> Elements .............................................................. D–1<br />

Appendix E. <strong>SYSLIB</strong> Common Bank Entry Points ..................................E–1<br />

Appendix F. Interface to Selected Extended Mode Executive<br />

Requests ............................................................................F–1<br />

F.1. Calling Sequence...................................................................... F–1<br />

F.2. Packet Generation .................................................................... F–2<br />

F.2.1. EM$READPKT ................................................................. F–2<br />

F.2.2. EM$PRINTPKT................................................................. F–3<br />

F.2.3. EM$TREADPKT ............................................................... F–4<br />

F.2.4. EM$SNAPPKT ................................................................. F–5<br />

F.3. Example.................................................................................... F–6<br />

Appendix G. INFOR Information ............................................................ G–1<br />

G.1. INFOR Identifiers for Processor Call Statement ..................... G–1<br />

G.2. The INFOR Table ..................................................................... G–3<br />

G.3. INFOR Table Conventions....................................................... G–7<br />

G.4. INFOR Table Example ............................................................. G–8<br />

G.5. Reading the INFOR Table........................................................ G–9<br />

G.6. Determining the INFOR Table Size ......................................... G–9<br />

Appendix H. ASCII-like Character Sets ................................................. H–1<br />

Appendix I. Extended Mode Interface to <strong>SYSLIB</strong> .................................. I–1<br />

I.1. General ...................................................................................... I–1<br />

I.2. Interface to the AEDIT$ Package .............................................. I–2<br />

I.3. Interface to BSP$ ...................................................................... I–5<br />

I.4. Interface to FDASC$ ................................................................. I–9<br />

I.5. Interface to GETPSF$.............................................................. I–10<br />

I.6. Interface to ID$ ....................................................................... I–12<br />

I.7. Interface to INFOR$ ................................................................ I–13<br />

I.8. Interface to MFDSP$............................................................... I–15<br />

7833 1733–004 xi


Contents<br />

Appendix J. Obsolete Entry Points, PROCs, and Routines.....................J–1<br />

J.1. AEDIT$–Generating the AEDIT$ Packet .................................. J–1<br />

J.1.1. A$EPKT ........................................................................... J–1<br />

J.1.2. A$EPKTF ......................................................................... J–1<br />

J.1.3. A$EPKTSFDT................................................................... J–2<br />

J.1.4. Examples of Generating the AEDIT$ Packet................... J–2<br />

J.2. CONWRD$–MASM PROCs and Entry Points ......................... J–2<br />

J.3. EOUT$–Generalized Output Editing Routine ........................... J–3<br />

J.3.1. Editing Functions............................................................. J–5<br />

J.3.2. Output Functions............................................................. J–6<br />

J.3.3. Modal Functions.............................................................. J–7<br />

J.3.4. Control Functions ............................................................ J–8<br />

J.3.5. EOUT$–Calling Sequences ............................................. J–9<br />

J.4. I$D–Calling Sequence ............................................................ J–11<br />

J.5. IDLINE$ and IDONLY$–Identification Line<br />

Routines............................................................................. J–13<br />

J.5.1. IDLINE$ ......................................................................... J–14<br />

J.5.1.1. IDLINE$ ................................................................ J–14<br />

J.5.1.2. IDTIME$................................................................ J–15<br />

J.5.2. IDONLY$ ....................................................................... J–15<br />

J.5.2.1. IDONLY$............................................................... J–15<br />

J.5.2.2. IDTOME$.............................................................. J–15<br />

J.6. SFDT$–MASM Calling Sequence .......................................... J–15<br />

J.7. SYS$RLIB$ID–RLIB Identification.......................................... J–16<br />

J.8. PIRCB$ Common Bank Entry Points ..................................... J–17<br />

Appendix K. Related Product Information............................................. K–1<br />

Glossary ..............................................................................................1<br />

Index ..............................................................................................1<br />

xii 7833 1733–004


Figures<br />

4–1. AEDIT$: Packet Format ...................................................................................... 4–3<br />

5–1. BSP$: File Control Table (FCT) .......................................................................... 5–5<br />

8–1. EDIT$: Packet Format ....................................................................................... 8–2<br />

12–1. INFOR$: Format of the ELT$ Table.................................................................. 12–9<br />

14–1. PARTBL Table Format ...................................................................................... 14–4<br />

15–1. ROR: Item Format ............................................................................................ 15–3<br />

16–1. SAR$: Attribute Table Entry ........................................................................... 16–12<br />

17–1. SAR$: Attribute Table Entry ........................................................................... 17–11<br />

18–1. SAR$: Attribute Table Entry ........................................................................... 18–11<br />

21–1. SDFI: Packet Format ....................................................................................... 21–3<br />

21–2. SDFO: Packet Format..................................................................................... 21–11<br />

22–1. SFDT$: Packet Format ..................................................................................... 22–3<br />

7833 1733–004 xiii


Figures<br />

xiv 7833 1733–004


Tables<br />

2–1. MAXR$: Control Register and Partial Word Designator Mnemonics................. 2–3<br />

2–2. SSTYP$: Element Subtypes .............................................................................. 2–5<br />

2–3. ASUBTYP$: Absolute Element Subtypes and Sub-subtypes............................ 2–7<br />

2–4. SYS$DEF: System Standard Definitions ........................................................... 2–8<br />

4–1. AEDIT$: Initialization and Termination Editing Routines ................................... 4–9<br />

4–2. AEDIT$: General Purpose ASCII Editing Routines .......................................... 4–10<br />

4–3. AEDIT$F: Floating-Point ASCII Editing Routines ............................................. 4–16<br />

4–4. AEDIT$T: ASCII Time and Date Editing Routines ........................................... 4–18<br />

4–5. AEDIT$: Error Status Codes............................................................................ 4–24<br />

8–1. Initialization and Termination.............................................................................. 8–5<br />

8–2. General-Purpose Editing Routines ..................................................................... 8–6<br />

8–3. Time and Date Editing Routines......................................................................... 8–8<br />

8–4. EDIT$F–Floating-Point Editing Routines........................................................... 8–10<br />

12–1. INFOR$: RINF$ Error Messages ..................................................................... 12–5<br />

16–1. SAR$: Attribute Types and Values ................................................................ 16–13<br />

17–1. SAR$: PLUS READ Buffer and Table Length Defaults ................................. 17–12<br />

17–2. SAR$: PLUS READ Buffer and Table Type Definitions ................................. 17–12<br />

17–3. SAR$: READ Procedure CALL_STATUS Codes ............................................ 17–17<br />

17–4. SAR$: READ Procedure IO_STATUS Status List .......................................... 17–19<br />

17–5. SAR$: MASM READ Buffer and Table Lengths............................................ 17–27<br />

17–6. SAR$: READ Procedure SR$CALLST Status Codes ..................................... 17–30<br />

17–7. SAR$: READ Procedure SR$IOSTAT Status Codes...................................... 17–32<br />

18–1. SAR$: PLUS WRITE Buffer and Table Length Defaults................................ 18–12<br />

18–2. SAR$: PLUS WRITE Buffer and Table Type Definitions ............................... 18–12<br />

18–3. SAR$: WRITE Procedure CALL_STATUS Codes .......................................... 18–19<br />

18–4. SAR$: WRITE Procedure IO_STATUS Status List......................................... 18–21<br />

18–5. SAR$: MASM WRITE Buffer and Table Lengths .......................................... 18–29<br />

18–6. SAR$: WRITE Procedure SW$CALLST Codes.............................................. 18–32<br />

18–7. SAR$: WRITE Procedure SW$IOSTAT Status List ....................................... 18–34<br />

19–1. SAR$: PLUS ATREAD Buffer and Table Length Defaults ............................... 19–7<br />

19–2. SAR$: PLUS ATREAD Buffer and Table Type Definitions............................... 19–7<br />

19–3. SAR$: ATREAD Procedure CALL_STATUS Codes........................................ 19–11<br />

19–4. SAR$: ATREAD Procedure IO_STATUS Status List...................................... 19–13<br />

19–5. SAR$: MASM ATREAD Buffer and Table Lengths ....................................... 19–19<br />

19–6. SAR$: ATREAD Procedure SA$CALLST Status Codes................................. 19–23<br />

19–7. SAR$: ATREAD Procedure SA$IOSTAT Status Codes ................................. 19–24<br />

7833 1733–004 xv


Tables<br />

20–1. SAR$: PLUS COM Buffer and Table Length Defaults .................................... 20–7<br />

20–2. SAR$: PLUS COM Buffer and Table Type Definitions.................................... 20–7<br />

20–3. SAR$: COM Procedure CALL_STATUS Codes............................................... 20–9<br />

20–4. SAR$: MASM COM Buffer and Table Lengths ............................................ 20–17<br />

20–5. SAR$: COM Procedure SC$CALLST Status Codes...................................... 20–19<br />

B–1. SIR$: Line-change Diagnostics .........................................................................B–5<br />

D–1. <strong>SYSLIB</strong> Elements ...............................................................................................D–1<br />

D–2. <strong>SYSLIB</strong> Common Bank Absolute Elements.......................................................D–5<br />

E–1. <strong>SYSLIB</strong>$1 Entry Points....................................................................................... E–1<br />

E–2. <strong>SYSLIB</strong>$2 Entry Points....................................................................................... E–4<br />

E–3. <strong>SYSLIB</strong>$3 Entry Points....................................................................................... E–5<br />

E–4. <strong>SYSLIB</strong>$4 Entry Points....................................................................................... E–5<br />

H–1. Character Set Types...........................................................................................H–1<br />

I–1. EM$EDIT Function Codes................................................................................... I–3<br />

I–2. EM$EDIT First Parameter Field Values............................................................... I–4<br />

I–3. EM$EDIT Second Parameter Field Values.......................................................... I–4<br />

I–4. EM$BSP Function Codes.................................................................................... I–7<br />

I–5. EM$BSP Parameter Field Values........................................................................ I–7<br />

I–6. EM$INFOR Function Codes.............................................................................. I–13<br />

I–7. EM$INFOR Additional Parameter Field Values................................................. I–14<br />

I–8. EM$MFDSP Function Codes ............................................................................ I–16<br />

I–9. EM$MFDSP Parameter Field Values ................................................................ I–16<br />

J–1. IDLINE$, IDONLY$: IDBUFF Length............................................................... J–14<br />

J–2. PIRCB$ Entry Points ........................................................................................ J–17<br />

xvi 7833 1733–004


Section 1<br />

Introduction<br />

1.1. About This <strong>Manual</strong><br />

This manual is a detailed programming reference for the OS 2200 System Service<br />

Routines Library (<strong>SYSLIB</strong>). The descriptions of the <strong>SYSLIB</strong> routines include their calling<br />

sequence, parameters, and error or normal returns.<br />

Master Doc PLE<br />

This manual contains all the information that was available at the time of publication.<br />

Technical changes that were not available at the time of publication are documented in<br />

problem list entry (PLE) 17668757. To obtain a copy of this PLE, log on with entitled<br />

privileges to the Unisys Product <strong>Support</strong> web site (http://www.support.unisys.com/) or<br />

contact your Unisys representative.<br />

Audience<br />

This manual is for developers of both application and system software in the OS 2200<br />

environment. This standardized implementation of commonly required services<br />

eliminates the need for detailed knowledge of internal OS 2200 data structures, which<br />

are subject to change.<br />

Prerequisites<br />

To use the Service Library routines effectively, the programmer should be familiar with<br />

• OS 2200 concepts, facilities, and job control language<br />

• Executive system (Exec) concepts and facilities<br />

• MASM and PLUS programming languages<br />

7833 1733–004 1–1


Introduction<br />

1.2. Notation Conventions<br />

In this manual, the 36 bits of the computer word are numbered from left to right. For<br />

example:<br />

0 8 9 17 18 26 27 35<br />

The following mnemonics define partial-word references:<br />

sixth- S1 S2 S3 S4 S5 S6<br />

word 0 5 6 11 12 17 18 23 24 29 30 35<br />

quarter- Q1 Q2 Q3 Q4<br />

word 0 8 9 17 18 26 27 35<br />

third- T1 T2 T3<br />

word 0 11 12 23 24 35<br />

half- H1 H2<br />

word 0 17 18 35<br />

The 2200 Series Assembler mnemonics are used whenever machine instructions are<br />

discussed. The Assembler mnemonics for partial-word transfers and registers are<br />

defined in the MASM definition element MAXR$. These mnemonics are used in<br />

assembly language programs.<br />

The mnemonics U and XU indicate immediate data references. (The operand is taken<br />

directly from the address portion of the instruction rather than from the main storage<br />

referenced by that address.) The mnemonics XH1, XH2, and XU indicate that the system<br />

will load the 18-bit value with sign extension to 36 bits (in other words, if bit 18 is a one,<br />

bits 0 through 17 are set to one). This does not affect the store operation.<br />

Control registers are referenced with the following mnemonics:<br />

A0, A1,..., A15<br />

Accumulators (A0 through A3 can also be used as index registers.)<br />

A15+1, A15+2<br />

Additional accumulators for double- or triple-precision instructions<br />

1–2 7833 1733–004


X1, X2,..., X11<br />

Index registers<br />

R1, R2,..., R15<br />

R registers<br />

Activities may use one of two control register sets.<br />

Major set<br />

All control registers as described above<br />

Minor set<br />

Registers X8 through X11; A0 through A5; R1, R2, and R3<br />

Introduction<br />

Subroutines frequently use a subset of the minor set, called volatile registers. This<br />

subset includes<br />

Volatile set<br />

Registers X11, A0 through A5, R1, R2, and R3<br />

The volatile register set is assumed to be available for all routines in <strong>SYSLIB</strong>. The<br />

AEDIT$/EDIT$ routines also use registers X1, X2, and X3, which are saved and restored.<br />

When a subroutine uses one of the volatile registers, the register is not saved or<br />

replaced. Any registers that are used but are not part of the volatile register set are<br />

saved and restored.<br />

The AEDIT$/EDIT$ routines assume that a subset of the volatile register set is available.<br />

These registers are: A0, A1, A2, A3, R1, and X11, and they are not saved or restored.<br />

The dollar sign ($) is generally used in system-defined external symbols, procedure<br />

names, and file names; to avoid duplication, do not use this character. The $ generally<br />

occurs as the last character of a symbol; an exception is procedure names in which the $<br />

is usually the second character.<br />

In calling sequences and table formats, parameters in italic type indicate information that<br />

the calling program supplies; parameters in regular type indicate information that the<br />

system returns.<br />

Brackets indicate optional parameters. (The brackets are not part of the parameter and<br />

are not included by the calling program.)<br />

The symbol ∆ indicates a blank character.<br />

In control statements, Executive requests, and procedure call formats, capital letters<br />

indicate code that should be used as shown. Lowercase letters represent variables that<br />

should be used as the text directs.<br />

7833 1733–004 1–3


Introduction<br />

Numbers are represented as in Assembler syntax; that is, a leading zero specifies octal.<br />

Control statements have the following general format:<br />

@label:command,options parameters . comments<br />

or<br />

@@command,options parameters . comments<br />

Parameters are separated by commas. A field may specify a single parameter, or it may<br />

contain several related parameters in subfields. Slashes (///) separate subfields. An<br />

ellipsis (...) indicates that there may be any number of additional parameters following<br />

the format of the last shown (for example, reel numbers of a tape file or elements to be<br />

listed).<br />

See the ECL and FURPUR <strong>Reference</strong> <strong>Manual</strong> for a complete discussion of control<br />

statement syntax.<br />

1.3. About <strong>SYSLIB</strong><br />

<strong>SYSLIB</strong> contains absolute, object module, omnibus, procedure, relocatable, and symbolic<br />

elements.<br />

The <strong>SYSLIB</strong> routines can be grouped into six functional areas. The following groupings<br />

are only a subset of the <strong>SYSLIB</strong> elements. For a complete listing of all <strong>SYSLIB</strong><br />

elements, see Appendix D.<br />

• System Procedures, Definitions, and Entry Points<br />

AXR$ SYS$DEF<br />

MAXR$ SSTYP$<br />

PROC$ TABLE$<br />

SDFP$ <strong>SYSLIB</strong>$ID<br />

• Collector Interface Routines<br />

DLOAD$ IDLAD$<br />

IDL$ IDLD$<br />

IDLA$ SNAP$<br />

• Diagnostic and Debugging Routines<br />

CABSAD$ CRELAD$<br />

CONWRD$ SNOOPY<br />

1–4 7833 1733–004


• Editing Routines<br />

AEDIT$ SFDT$DG<br />

AEDIT$F SFDTBL$<br />

AEDIT$SFDT EDIT$<br />

AEDIT$T EDIT$F<br />

SFDT$ EDIT$T<br />

SFDT$D<br />

• Processor Interface Routines (PIRs)<br />

BSP$ PREPRM<br />

GETPSF$ PREPRO<br />

ID$ ROR<br />

INFOR$ SAR$<br />

POSTPR$ SIR$<br />

PREPF$ SOR<br />

• Utility Routines<br />

FDASC$ SDFI<br />

MFDSP$ SDFO<br />

Introduction<br />

The Collector <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> explains the Collector interface routines.<br />

This manual describes the remaining routines.<br />

The method you use to install the <strong>SYSLIB</strong> routines determines which file or files will<br />

contain the routines. If you install <strong>SYSLIB</strong> without COMUS, then the routines are placed<br />

in two files, SYS$*RLIB$ and SYS$*LIB$. If you install with COMUS, all of the routines<br />

are placed in the SYS$LIB$*<strong>SYSLIB</strong> file. The following paragraphs explain these two<br />

arrangements.<br />

If you install <strong>SYSLIB</strong> without COMUS, the <strong>SYSLIB</strong> routines are contained in the system<br />

relocatable library file SYS$*RLIB$ along with other relocatable libraries. When a<br />

program calls a <strong>SYSLIB</strong> routine, the Collector automatically searches SYS$*RLIB$ for the<br />

routine and places the routine in the absolute program that the Collector is constructing.<br />

Subsets of the <strong>SYSLIB</strong> routines are also contained in common banks. These common<br />

banks reside in the system absolute library file SYS$*LIB$. The routines in the common<br />

banks are the AEDIT$ package (AEDIT$, AEDIT$F, AEDIT$SFDT), BSP$, CABSAD$ and<br />

CRELAD$, CONWRD$, FDASC$ (and TABLE$), GETPSF$, ID$, INFOR$, MFDSP$,<br />

SAR$, SDFI, SDFO, and SFDT$ (and SFDTBL$). See Section 3 for details of how to<br />

access the routines in the <strong>SYSLIB</strong> common banks.<br />

7833 1733–004 1–5


Introduction<br />

If you install <strong>SYSLIB</strong> using COMUS (level 4R2 and higher), all of the routines and the<br />

common banks are placed in the <strong>SYSLIB</strong> product file SYS$LIB$*<strong>SYSLIB</strong>. The Collector<br />

(level 31R2 and higher) automatically searches SYS$LIB$*<strong>SYSLIB</strong> for referenced <strong>SYSLIB</strong><br />

routines and places them in the absolute program that it is constructing. MASM (level<br />

4R2 and higher) also automatically searches SYS$LIB$*<strong>SYSLIB</strong>.<br />

Several restrictions apply to the released level of <strong>SYSLIB</strong>. For details of these<br />

restrictions, see Appendix C.<br />

1–6 7833 1733–004


Section 2<br />

System Standard Procedures and<br />

Definitions<br />

This section describes system definitions and procedures that are provided by <strong>SYSLIB</strong>.<br />

System definitions are supplied to calling programs for information such as<br />

• Mnemonics for control registers<br />

• Names and bank descriptor indexes (BDI) for some system configured common<br />

banks and entry points to the common banks<br />

• Program file element subtype mnemonics and codes<br />

<strong>SYSLIB</strong> procedures perform functions such as<br />

• Generating calling sequences to <strong>SYSLIB</strong> routines<br />

• Generating ASCII and Fieldata character sets<br />

• Defining ASCII control characters<br />

2.1. Common Bank Entry Points<br />

System configured common bank names, their associated BDI values, and the absolute<br />

values of the entry points to the common banks are defined in relocatable elements with<br />

CBEP$$ as the first six characters of the element name. This element naming<br />

convention is used by the Collector to detect the use of configured common banks.<br />

During program collection, the Collector automatically includes CBEP$$ elements that<br />

contain configured common bank names or entry points referenced in the program being<br />

collected.<br />

7833 1733–004 2–1


System Standard Procedures and Definitions<br />

The relocatable element CERU$ is located in the EXEC system relocatable library file,<br />

SYS$*RLIB$. CERU$ reserves 620 BDI values for users. The BDI values reserved for<br />

users are<br />

0400300 to 0400323<br />

0400400 to 0400411<br />

0400500 to 0400511<br />

0400600 to 0400611<br />

0400700 to 0400711<br />

0401000 to 0401011<br />

0401100 to 0401111<br />

0401200 to 0401211<br />

. . .<br />

. . .<br />

0403300 to 0403311<br />

. . .<br />

. . .<br />

0407700 to 0407711<br />

2.2. MAXR$–Register and Partial-Word Definitions<br />

MAXR$ is a MASM definition mode (omnibus) element that defines mnemonic<br />

designators for<br />

• Control registers<br />

• Base registers<br />

• J-registers and staging registers<br />

• Partial-word designators<br />

For a complete description of these registers, refer to the applicable processor and<br />

storage reference or the AIM <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

Table 2–1 lists the mnemonic designators and absolute addresses of control registers<br />

and partial-word designators that MAXR$ contains.<br />

All registers used in assembler programs must be defined. The following example<br />

shows how to include MAXR$ in assembly language source code. MAXR$ defines the<br />

register (A0) and J-designator (U).<br />

$(1),START<br />

$INCLUDE 'MAXR$'<br />

L,U A0,1<br />

ER EXIT$<br />

$END START<br />

2–2 7833 1733–004


System Standard Procedures and Definitions<br />

The MASM PROC AXR$ also defines these mnemonic designators.<br />

Table 2–1. MAXR$: Control Register and Partial Word Designator Mnemonics<br />

Base Registers<br />

Index<br />

Registers<br />

Arithmetic<br />

Registers<br />

R-Registers<br />

Staging<br />

Registers and<br />

J-Registers<br />

Partial-Word<br />

Designators<br />

Mne Val Mne Abs Mne Abs Mne Abs Mne Abs Mn-J J-Va<br />

B0 0 X0 0 A0 14 R0 100 SR1 103 W (or<br />

none)<br />

B1 1 X1 1 A1 15 R1 101 SR2 104 H1 1<br />

B2 2 X2 2 A2 16 R2 102 SR3 105 H2 2<br />

B3 3 X3 3 A3 17 R3 103 J0 106 XH2 3<br />

B4 4 X4 4 A4 20 R4 104 J1 107 XH1 4<br />

B5 5 X5 5 A5 21 R5 105 J2 110 T3 5<br />

B6 6 X6 6 A6 22 R6 106 J3 111 T2 6<br />

B7 7 X7 7 A7 23 R7 107 T1 7<br />

B8 10 X8 10 A8 24 R8 110 S1 15<br />

B9 11 X9 11 A9 25 R9 111 S2 14<br />

B10 12 X10 12 A10 26 R10 112 S3 13<br />

B11 13 X11 13 A11 27 R11 113 S4 12<br />

B12 14 A12 30 R12 114 S5 11<br />

B13 15 A13 31 R13 115 S6 10<br />

B14 16 A14 32 R14 116 Q1 7<br />

B15 17 A15 33 R15 117 Q2 4<br />

Legend<br />

Mne Mnemonic<br />

Val Value (octal)<br />

Abs Absolute (octal)<br />

Mn-J Mnemonic for J<br />

J-Val J-Value (octal)<br />

7833 1733–004 2–3<br />

0


System Standard Procedures and Definitions<br />

2.3. PROC$–System Procedures<br />

PROC$ is an element that contains the following assembler procedures (PROC). Refer<br />

to the designated section of this manual or to the other manuals listed below for<br />

instructions on how to use these procedures. Only those PROCs that are not described<br />

elsewhere in this document are listed.<br />

• Collector segment loading PROCs. See the Collector <strong>Programming</strong> <strong>Reference</strong><br />

<strong>Manual</strong>. (L$OAD, D$REL, D$LOAD)<br />

• Procedures that generate calls to the PMD dynamic dump routines (X$MARK,<br />

X$BACK, X$BUFR, X$SIZE, X$IF, X$OR, X$AND, X$LST, X$TALY, X$FRMT,<br />

X$MESG, X$CREG, X$DUMP, X$CORE, X$DRUM, X$TAPE, X$FILE, X$CW, X$ON,<br />

X$OFF). See the PMD <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

• Procedures, ASCII and FIELDATA, used with the Meta-Assembler (MASM) to<br />

change the radix for generating character data.<br />

• Procedure A$SCTRL to define mnemonics for the ASCII control characters<br />

corresponding to octal codes 0 through 37 and 177. See the ER <strong>Programming</strong><br />

Quick-<strong>Reference</strong> Guide.<br />

• J$REG PROC to aid loading J-registers in character addressing mode. See the AIM<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

• I$BJ and D$BJ PROC calls to generate IBJ$ (DBJ$) calling sequences used by the<br />

Collector in bank switching. See the Collector <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

• U$C function to uppercase ASCII character string. For example<br />

P$ $PROC<br />

U$C<br />

TYPE $EQU U$C(P$(0,1) . Get type in uppercase ASCII<br />

$IF TYPE='A'<br />

...<br />

$ENDF<br />

$END<br />

2.4. SSTYP$–Element Subtypes<br />

SSTYP$ is a nonexecutable relocatable element consisting of a table of standard<br />

symbolic and omnibus element subtype names and their associated values. It has a<br />

single external definition, SSTYP$. SSTYP$ is the address of a word that contains the<br />

length of the table. The table begins at SSTYP$ + 1.<br />

The element subtype number is used to index into the SSTYP$ table to obtain the<br />

corresponding Fieldata name. For example, the octal value for an element subtype of<br />

'PLS' (PLUS) is 015. The word at address SSTYP$+16 contains the Fieldata characters<br />

'PLS∆∆∆'.<br />

2–4 7833 1733–004


System Standard Procedures and Definitions<br />

If the element subtype number exceeds the length of SSTYP$, no table entry exists.<br />

The released table length is 64 words. If the element subtype number does not have a<br />

definition, SSTYP$ contains the number in Fieldata characters. For example, the octal<br />

value 076 does not have a subtype definition assigned to it. The word at address<br />

SSTYP$+077 contains the Fieldata characters '076∆∆∆'.<br />

Entries in the SSTYP$ table are one to four Fieldata characters per word, left-justified and<br />

space-filled.<br />

The element subtype codes are stored in the element table items in the program file<br />

table of contents. See 5.1.7 regarding packet formats for table item add.<br />

Table 2–2 contains the currently defined symbolic and omnibus element subtypes.<br />

Table 2–2. SSTYP$: Element Subtypes<br />

Mnemonic Code Description<br />

SYM 00 Symbolic (No subtype)<br />

ELT 01 ELT<br />

ASM 02 Assembler<br />

COB 03 COBOL<br />

FOR 04 FORTRAN<br />

ALG 05 ALGOL<br />

MAP 06 Collector<br />

DOC 07 Document processor<br />

SEC 010 SECURE processor<br />

SSG 011 Symbolic Stream Generator<br />

APL 012 A <strong>Programming</strong> Language<br />

BAS 013 BASIC<br />

LSP 014 LISP<br />

PLS 015 PLUS<br />

PL1 016 PL/I<br />

CTS 017 Conversational Time Sharing<br />

FLT 020 FLIT processor<br />

PNC 021 Panic<br />

TCL 022 Traffic Control Language<br />

MSM 023 Meta-Assembler (MASM)<br />

MSD 024 MASM definition language<br />

MAC 025 MACRO<br />

APT 026 Automatically Programmed Tools<br />

7833 1733–004 2–5


System Standard Procedures and Definitions<br />

Table 2–2. SSTYP$: Element Subtypes<br />

Mnemonic Code Description<br />

PGA 027 PROMEGA<br />

QLP 030 Query Language Processor<br />

INL 031 PLUS INLINE processor<br />

DCL 032 Declaration Control Language<br />

SDL 033 System Definition Language<br />

FDP 034 File Definition Processor<br />

PSP 035 PLUS Procedure<br />

PAS 036 PASCAL<br />

IPF 037 Interactive Processing Facility<br />

GSA 040 General Syntax Analyzer<br />

MSG 041 Local language message system<br />

(LLMS)<br />

PRT 042 Symbionts<br />

RPG 043 Report Program Generator<br />

ADA 044 Ada language<br />

PEER 045 Program Execution Evaluation Routine<br />

C 046 C language<br />

FHLL 047 FLIT High-Level Language<br />

LINK 050 Linking System<br />

COM 051 COMUS<br />

PADS 052 Programmer's Advanced Debugging<br />

System<br />

SSDP 053 Subsystem Definition Processor<br />

FLDP 054 Form Language Definition Processor<br />

(DPS)<br />

2–6 7833 1733–004


System Standard Procedures and Definitions<br />

2.5. ASUBTYP$–Executable Element Subtypes and<br />

Sub-subtypes<br />

ASUBTYP$ is a nonexecutable relocatable element consisting of a table of executable<br />

element subtype and sub-subtype mnemonics. An executable element can be one of<br />

several subtypes and each subtype can have sub-subtypes associated with it.<br />

For the absolute element subtype/sub-subtype table, a two-part access must be used.<br />

Because each absolute subtype can have more than one associated sub-subtype, the<br />

first access obtains a pointer to the subtype's sub-subtype mnemonic table. The second<br />

access, using the sub-subtype value from the element table, will obtain the Fieldata<br />

mnemonic for the absolute element.<br />

The initial access is off of ASUBTYP$ + 1 as follows:<br />

LA A0,ASUBTYP$+1,A0<br />

Here, A0 is conditioned with the absolute element's subtype from word 7, bits 0–5 in the<br />

element table entry. Next, with A1 conditioned with the element's sub-subtype value<br />

from word 7, bits 6–11 in the element table entry:<br />

AA,U A0,1,A1<br />

Register A0 now points into the sub-subtype mnemonic table for the particular subtype,<br />

then:<br />

LA A1,0,A0<br />

Register A1 contains the Fieldata mnemonic identifying the absolute element.<br />

The Data Structures <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> contains details on the program file<br />

element table entry for absolute elements.<br />

Table 2–3 contains the currently defined absolute element subtypes and sub-subtypes.<br />

Table 2–3. ASUBTYP$: Absolute Element Subtypes and<br />

Sub-subtypes<br />

Mnemonic Numeric Subtype Numeric Sub-subtype Description<br />

ABS 0 0 Absolute<br />

OM 1 0 Object Module<br />

BOM 1 1 Bound Object Module<br />

SSD 2 0 Subsystem Definition<br />

ZOOM 3 1 Zero Overhead Object<br />

Module<br />

7833 1733–004 2–7


System Standard Procedures and Definitions<br />

2.6. SYS$DEF–System Definitions<br />

<strong>SYSLIB</strong> provides SYS$DEF as a relocatable, omnibus, and object module element that<br />

equates externally defined mnemonic names to system definitions. These definitions<br />

can be obtained during an assembly by including the following in the source code:<br />

$INCLUDE 'SYS$DEF'. Table 2–4 contains the mnemonic names and values defined by<br />

SYS$DEF.<br />

Table 2–4. SYS$DEF: System Standard Definitions<br />

Name Description<br />

CYCLIM$ Symbolic element cycle maximum<br />

EMPCTBD$ BDI value for Extended Mode user PCT bank<br />

PCTBD$ BDI value for user PCT bank<br />

PFET$ Starting sector address of the element table<br />

PFAPT$ Starting sector address of the assembler procedure table<br />

PFCPT$ Starting sector address of the COBOL procedure table<br />

PFFPT$ Starting sector address of the FORTRAN/PLUS procedure table<br />

PFEPT$ Starting sector address of the relocatable element entry point table<br />

PFTEXT$ Starting sector address of the element text area<br />

LPF$ET Starting sector address of the large program file element table<br />

LPF$APT Starting sector address of the large program file assembler procedure<br />

table<br />

LPF$CPT Starting sector address of the large program file COBOL procedure<br />

table<br />

LPF$FPPT Starting sector address of the large program file FORTRAN/PLUS<br />

procedure table<br />

LPF$REEPT Starting sector address of the large program file relocatable element<br />

entry point table<br />

LPF$TEXT Starting sector address of the large program file element text area<br />

RPCTA$ User entry point to PCT bank<br />

PF$ID Program file identifier<br />

LPF$ID Large program file identifier<br />

LEPF$ID Large element program file identifier<br />

PF$LEVEL0 Current revision level for the standard program file<br />

LPF$LEVEL1 Current revision level for the large program file<br />

LEPF$LEVEL1 Current revision level for the large element program file<br />

ASCLIKE$ A 72-bit ASCII-like bit mask. Bit 71-n is set to 1 if coded character set<br />

(CCS) n is defined as ASCII-like. Otherwise, the bit is 0. See<br />

Table 1–1. This double-word equate is defined only for the omnibus<br />

version of SYS$DEF.<br />

2–8 7833 1733–004


System Standard Procedures and Definitions<br />

2.7. <strong>SYSLIB</strong>$ID–<strong>SYSLIB</strong> Identification<br />

<strong>SYSLIB</strong>$ID is a relocatable element in the <strong>SYSLIB</strong> installation file, SYS$LIB$*<strong>SYSLIB</strong>. It<br />

is also included in each of the <strong>SYSLIB</strong> common banks. This element identifies the<br />

<strong>SYSLIB</strong> level only. That is, it does not perform any functions. <strong>SYSLIB</strong>$ID defines the<br />

following external labels:<br />

<strong>SYSLIB</strong>$ID1 First 4 characters of ID in ASCII<br />

<strong>SYSLIB</strong>$ID2 Second 4 characters of ID in ASCII<br />

<strong>SYSLIB</strong>$ID3 Third 4 characters of ID in ASCII<br />

For example, the definitions for <strong>SYSLIB</strong> 75R2Q7 are<br />

<strong>SYSLIB</strong>$ID1 $EQU 75R2<br />

<strong>SYSLIB</strong>$ID2 $EQU Q7∆∆<br />

<strong>SYSLIB</strong>$ID3 $EQU ∆∆∆∆<br />

7833 1733–004 2–9


System Standard Procedures and Definitions<br />

2–10 7833 1733–004


Section 3<br />

<strong>SYSLIB</strong> Access Methods<br />

<strong>SYSLIB</strong> routines AEDIT$, AEDIT$F, AEDIT$SFDT, BSP$, CABSAD$, CRELAD$,<br />

CONWRD$, FDASC$, GETPSF$, INFOR$, ID$, MFDSP$, SAR$, SDFI, SDFO, and SFDT$<br />

are available as both relocatable and common bank routines. When using the common<br />

bank version of these routines, the library routine is not collected into the calling<br />

program.<br />

The calling program contains a jump to the common bank that contains the library<br />

routine, but the actual code of the library routine remains in the common bank. Because<br />

the common bank code does not get collected into the calling program, as the<br />

relocatable versions of the routines do, the calling program will be smaller. In cases<br />

where the library routine is large, this can result in a considerable saving of space. Also,<br />

since the common bank library routines exist independently of the calling programs, they<br />

may be modified without forcing the calling programs to be recompiled or re-collected.<br />

The jumps in the calling program remain valid even though the common bank code itself<br />

changes. When transporting an absolute program from one machine to another, the<br />

second machine must have the common bank library routines installed or the absolute<br />

program may guard mode or produce unpredictable results.To check on whether the<br />

<strong>SYSLIB</strong> common bank routines have been installed, it is only necessary to look for the<br />

absolute elements <strong>SYSLIB</strong>$1, <strong>SYSLIB</strong>$2, <strong>SYSLIB</strong>$3, and <strong>SYSLIB</strong>$4 in the file that<br />

contains the <strong>SYSLIB</strong> routines. These elements replace the <strong>SYSLIB</strong> common bank<br />

PIRCB$. However, PIRCB$ is still included to enable programs that were collected<br />

before the installation of <strong>SYSLIB</strong> level 75R3 to continue to run correctly.<br />

If an installation of <strong>SYSLIB</strong> is done using COMUS level 4R2 (and higher levels), then the<br />

<strong>SYSLIB</strong> common banks are put in the file SYS$LIB$*<strong>SYSLIB</strong>. If COMUS is not used for<br />

the installation of <strong>SYSLIB</strong>, then the elements will be contained in the file SYS$*LIB$. All<br />

the <strong>SYSLIB</strong> common banks have a starting address of 01000.<br />

Table D–2 in Appendix D lists the highest address of all <strong>SYSLIB</strong> common banks. The<br />

address of the <strong>SYSLIB</strong> level identifier is kept at 01003. The first word of the identifier is<br />

the number of words in the identifier followed by the ASCII character representation of<br />

the <strong>SYSLIB</strong> level (for example, 75R3).<br />

Some of the common bank <strong>SYSLIB</strong> routines require the calling program to provide a data<br />

area or a packet containing information that the routine needs. This area must be<br />

contained within a bank that is write enabled and based when the <strong>SYSLIB</strong> routine is<br />

called, and its addressing range must not overlap that of the <strong>SYSLIB</strong> common bank.<br />

7833 1733–004 3–1


<strong>SYSLIB</strong> Access Methods<br />

All the <strong>SYSLIB</strong> routines are available as relocatable elements. The routines listed at the<br />

beginning of this section are also available as common bank routines. For the <strong>SYSLIB</strong><br />

routines CABSAD$, CONWRD$, CRELAD$, GETPSF$, ID$, INFOR$, MFDSP$, and<br />

SFDT$, <strong>SYSLIB</strong> provides procedures that generate the calling sequence to access these<br />

routines. These procedures have been provided for the convenience of the calling<br />

program. Through the use of a parameter on the procedure call, they allow the calling<br />

program to access the relocatable version of the <strong>SYSLIB</strong> routine, the common bank<br />

version of the <strong>SYSLIB</strong> routine using the I$BJ calling sequence or the common bank<br />

version of the <strong>SYSLIB</strong> routine using the Auto Switch calling method.<br />

One of the advantages of using these procedures is that if a change to the calling<br />

sequence of the routine has to be made, an internal change to the <strong>SYSLIB</strong> calling<br />

procedure can also be made, and the calling program can remain the same. For the<br />

<strong>SYSLIB</strong> routines that do not have a procedure provided to generate the calling sequence,<br />

the calling program must explicitly code these instructions. The method for calling a<br />

particular <strong>SYSLIB</strong> routine is contained in the chapter describing the routine. Some<br />

general considerations on the different types of calls are given in the following<br />

subsections.<br />

3.1. Relocatable Collection Method<br />

The Relocatable Collection method causes the <strong>SYSLIB</strong> relocatable element to be<br />

collected into the calling program and become an integral part of it. Once this has been<br />

done, the resulting absolute element will not be affected by any changes made to the<br />

version of <strong>SYSLIB</strong> on the system. In other words, any <strong>SYSLIB</strong> routines the program<br />

requires are retrieved from the system library file and collected along with the other<br />

relocatable elements of the program to form an absolute element. If this type of call to<br />

<strong>SYSLIB</strong> is used, the resulting absolute can be transported from one system to another<br />

without regard as to what level of <strong>SYSLIB</strong> is on the other machine. Also, any changes<br />

made to <strong>SYSLIB</strong> after the program has been collected have no effect on how the<br />

program performs.<br />

For the <strong>SYSLIB</strong> routines that have a procedure to generate the calling sequence, this is<br />

the type of call that is generated as the default if the Common Bank call or Auto Switch<br />

call are not requested.<br />

3–2 7833 1733–004


3.2. Common Bank Call Using I$BJ<br />

<strong>SYSLIB</strong> Access Methods<br />

The I$BJ calling sequence is the preferred method of calling the <strong>SYSLIB</strong> common bank<br />

routines. For the <strong>SYSLIB</strong> routines with a calling procedure, this is the type of call that is<br />

generated when the calling program sets the parameter on the call to access the<br />

common bank version of the routine. This method provides a much more flexible means<br />

of using the <strong>SYSLIB</strong> routines than the Auto Switch method or explicitly coding an LIJ<br />

instruction, and it retains all the advantages associated with using the common bank<br />

version of the routines. That is, the calling program remains small because the <strong>SYSLIB</strong><br />

routines do not become an actual part of the calling program absolute. In addition, the<br />

calling program will automatically reference new versions of the <strong>SYSLIB</strong> routines as they<br />

are installed without the need for the calling program to be recompiled or re-collected.<br />

Another advantage to using the I$BJ calling sequence is that the calling program can<br />

switch between using the common bank version of the routines and the relocatable<br />

version of the routines by re-collecting the program with the proper collector EQU<br />

directives. A recompilation of the calling program is unnecessary; only a recollection is<br />

needed. For example, if the following call to the MFDSP$ routine were in a program, the<br />

common bank version of the MFDSP$ routine would be used.<br />

M$FDSP,'CB' PKTLENGTH,PKTADDR,FUNCCODE<br />

To force the program to use the relocatable version of the MFDSP$ routine, it would only<br />

be necessary to re-collect the program with the following Collector directives included:<br />

IN MFDSP$<br />

EQU CBMFDSP$/MFDSP$<br />

The Collector directive EQU forces the tag CBMFDSP$ to be evaluated as MFDSP$. An<br />

explicit inclusion of the element that contains the entry point MFDSP$ (in this case the<br />

element name is MFDSP$) is necessary to avoid errors during the collection. Appendix<br />

E lists the names of all the common banks and relocatable entry points and the names of<br />

the <strong>SYSLIB</strong> elements that include them. After the collection, the <strong>SYSLIB</strong> routine<br />

MFDSP$ is an integral part of the new absolute program. This adds about 1,000 words<br />

to the size of the absolute element.<br />

Programs that originally call the relocatable version of a <strong>SYSLIB</strong> routine, for example<br />

I$BJ X11,RFTI$ . BSP$, read file table index<br />

and that wish to call the common bank version of the routine need the following<br />

collector directives:<br />

IN CBEP$$<strong>SYSLIB</strong><br />

EQU RFTI$/CBRFTI$<br />

The Collector directive EQU forces the tag RFTI$ to be evaluated as CBRFTI$. The<br />

explicit inclusion of the element CBEP$$<strong>SYSLIB</strong> is necessary to resolve the reference to<br />

CBRFTI$. The element CBEP$$<strong>SYSLIB</strong> contains all the common bank entry point names<br />

and must be explicitly included in collections that use the EQU directive to switch from<br />

the relocatable version of a <strong>SYSLIB</strong> routine to the common bank version of the routine.<br />

7833 1733–004 3–3


<strong>SYSLIB</strong> Access Methods<br />

This type of switching between relocatable and common bank versions of a routine can<br />

be done as long as the calling program makes use of the I$BJ instruction instead of an<br />

LMJ or LIJ instruction to call the <strong>SYSLIB</strong> routines. For <strong>SYSLIB</strong> routines with a calling<br />

procedure, the field that determines the type of call to make to the routine must be set<br />

to 'CB' (common bank). If the field is set to 'A' (call the common bank version of the<br />

routine using the Auto Switch calling sequence) or left blank (a blank field means call the<br />

relocatable version of the routine), then the calling procedure generates an LMJ<br />

instruction. If an LMJ instruction or an LIJ instruction is generated to call the routine,<br />

then the program cannot switch between the common bank version and the relocatable<br />

version as described above.<br />

The I$BJ instruction is necessary because it remains undefined until the program is<br />

collected. At collection time, the I$BJ is resolved to an LMJ if the label being referenced<br />

resides in the same bank as the instruction referencing it, or it is resolved to an LIJ if the<br />

label is in another bank. Programs written before the implementation of the I$BJ routine<br />

may contain calling sequences such as the one that follows.<br />

LXI,U X11,PIRCB$<br />

LIJ X11,BASCFD$<br />

This sequence requires the calling program to know which common bank contains the<br />

routine as well as the name of the routine. Since the LIJ instruction is explicitly coded<br />

into this program, it always calls the common bank version of the <strong>SYSLIB</strong> ASCII to<br />

Fieldata routine. The program would have to be rewritten and reassembled to make it<br />

reference the relocatable version of the <strong>SYSLIB</strong> routine. A more flexible calling<br />

sequence is<br />

I$BJ X11,CBFDASC$<br />

The I$BJ procedure determines whether or not to generate a call to a common bank<br />

based on the label included on the call, in this case. If a common bank call is generated,<br />

the procedure handles retrieving the bank descriptor index of the common bank. Prior to<br />

executing the above calling sequence, the calling program must ensure that the correct<br />

values required by the <strong>SYSLIB</strong> routine have been loaded into the correct registers.<br />

For more information on common bank calls and the I$BJ routine, consult the Collector<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

3–4 7833 1733–004


<strong>SYSLIB</strong> Access Methods<br />

3.3. Common Bank Call Using Auto Switch Method<br />

The Auto Switch method of referencing the common bank version of the <strong>SYSLIB</strong><br />

routines requires the calling program to be explicitly aware of its own addressing<br />

structure. The program must know what banks are based and the addressing range of<br />

each bank. To access one of the <strong>SYSLIB</strong> routines, the calling program bases the<br />

particular <strong>SYSLIB</strong> common bank that contains the routine. (See Appendix D and<br />

Appendix E for the list of the <strong>SYSLIB</strong> common banks, the routines that are contained in<br />

them, and the addressing limits of the bank.) The program then executes an LMJ<br />

instruction to the common bank entry-point address minus 1. The calling program must<br />

ensure that none of the banks it has based overlap the <strong>SYSLIB</strong> addressing space.<br />

The advantage to this system is that the program may force the <strong>SYSLIB</strong> common bank<br />

to remain based so that multiple calls to routines in that bank can avoid the expense of<br />

basing the bank again and again. When the I$BJ method of accessing the common bank<br />

routines is used, it unbases the active bank of the calling program, bases the <strong>SYSLIB</strong><br />

common bank, executes the <strong>SYSLIB</strong> routine, then unbases the <strong>SYSLIB</strong> common bank<br />

and bases the calling program once again.<br />

The disadvantage to the Auto Switch method is that the structure of the calling program<br />

needs to be rigidly defined. Any changes to the program must always take into<br />

consideration what banks are based at what times and the addressing range of the<br />

banks. For these reasons, the use of the Auto Switch method is not encouraged. The<br />

Auto Switch calling method can only be used on systems that can base more than one<br />

bank simultaneously using the LIJ instruction.<br />

For the <strong>SYSLIB</strong> routines that have procedures to generate the calling code, the Auto<br />

Switch calling sequence is generated by appropriately setting a parameter on the<br />

procedure call.<br />

7833 1733–004 3–5


<strong>SYSLIB</strong> Access Methods<br />

3–6 7833 1733–004


Section 4<br />

AEDIT$–ASCII Image Composition<br />

Editing Package<br />

The AEDIT$ package is a set of ASCII editing subroutines. The calling program uses<br />

these subroutines to compose strings of ASCII characters in a specified data area.<br />

AEDIT$ is helpful in composing ASCII images for<br />

• ASCII output printed by ER APRINT$, ER APRNTA$, and ER SYMB$ (PRINT$)<br />

• ASCII output punched by ER APUNCH$, ER APNCHA$, and ER SYMB$ (PUNCH$)<br />

• Other Executive requests that require ASCII images, such as ER ASCF$, ER CSI$,<br />

and ER QECL$<br />

• Any other applications that require ASCII images<br />

AEDIT$ uses the full ASCII character set. Images are built up from individual characters<br />

or groups of characters or by copying character strings from other data areas. AEDIT$<br />

allows the calling program to use column settings when composing the ASCII image.<br />

AEDIT$ edits numeric data into ASCII characters. This includes decimal, octal, and<br />

floating-point numbers. The floating-point numbers can be either single-precision or<br />

double-precision. AEDIT$ also creates an ASCII string containing the date and time,<br />

using standard formats. AEDIT$ uses the current date and time, or a date and time<br />

specified by the calling program.<br />

AEDIT$ places the composed image in the data area or buffer provided by the calling<br />

program.<br />

AEDIT$ is reentrant and does not use any D-bank storage. The calling program supplies<br />

the packet for AEDIT$, which is used to pass information to and from the AEDIT$<br />

routines. The size of the AEDIT$ packet is 17 words. The packet format is described in<br />

4.1.<br />

AEDIT$ is available in both relocatable and common bank versions. The relocatable and<br />

common bank entry points for the AEDIT$ routines are listed in Appendix E.<br />

AEDIT$ establishes an "edit mode" while the image is being composed. The edit mode<br />

begins when the A$EDIT or A$EDITR PROCs are called and terminates when the<br />

A$EDITX or A$EPRINT PROCs are called. The AEDIT$ routines use the volatile register<br />

set. In addition, the relocatable version of AEDIT$ saves the contents of and uses<br />

registers X1, X2, and X3 during edit mode. These registers must not be modified during<br />

edit mode. AEDIT$ restores the original contents when exiting edit mode.<br />

7833 1733–004 4–1


AEDIT$–ASCII Image Composition Editing Package<br />

The common bank version of AEDIT$ uses only register X1 during edit mode. If the<br />

calling program modifies X1 during edit mode, it must reset H2 of X1 to the address of<br />

the AEDIT$ packet.<br />

The AEDIT$ editing package consists of five elements:<br />

AEDIT$ General-purpose editing routines<br />

AEDIT$F Floating-point editing routines<br />

AEDIT$P Procedure calls for editing routines<br />

AEDIT$SFDT System standard format date and time editing routines<br />

AEDIT$T Date and time editing routines<br />

AEDIT$ does not reference any other routines. AEDIT$T uses AEDIT$. AEDIT$SFDT<br />

uses AEDIT$ and SFDT$.<br />

The AEDIT$ routines expect input strings to be in the ASCII character set. The $ASCII<br />

MASM directive can be used to insure all generated strings (strings between single<br />

quotes) will be in the ASCII character set. Fieldata mode can be entered after the<br />

AEDIT$ routines by using the $FDATA MASM directive. If strings are generated in an<br />

area of the code that must remain in Fieldata mode, the $CAS (Convert to ASCII String)<br />

function may be used to convert specific strings to ASCII.<br />

4.1. Packet<br />

The calling program must provide a packet for the AEDIT$ routines. The AEDIT$ packet<br />

format and the procedure to generate the packet are described in the following<br />

subsections.<br />

4–2 7833 1733–004


4.1.1. Packet Format<br />

AEDIT$–ASCII Image Composition Editing Package<br />

The format of the AEDIT$ packet is shown in Figure 4–1. This packet format is provided<br />

for information only; the AEDIT$ packet is generated by the MASM procedures<br />

described in 4.1.2. The size of the AEDIT$ packet is 17 words. This packet is used for<br />

all AEDIT$, AEDIT$F, AEDIT$T, and AEDIT$SFDT functions.<br />

If A$EDITPKT is not called to generate the AEDIT$ packet, then the calling program must<br />

supply the fields of the AEDIT$ packet indicated by italics. All other fields in the packet<br />

are reserved for use by AEDIT$, and are not to be used by the calling program.<br />

0 5 6 11 12 17 18 23 24 29 30 35<br />

0 Test and<br />

Set<br />

1 character<br />

index<br />

qwm imagelength<br />

relative word<br />

index<br />

2 fps fpr flag<br />

bits<br />

AEMSG$<br />

character<br />

index<br />

image-address<br />

AEMSG$ word index<br />

zero return address for character store<br />

(22-bit absolute address)<br />

3 user's return address save of original X1 modifier<br />

4 save of original X2 contents, or save of character pointer<br />

5 save of original X3 contents, or save of word pointer<br />

6 msg dpc spc ilx<br />

7 reserved for future use<br />

(must be zero)<br />

digits before<br />

decimal point<br />

digits after<br />

decimal<br />

point<br />

negative<br />

sign<br />

8 final column position exponent's power of 10<br />

9 save area for intermediate floating-point results<br />

10<br />

not<br />

normalized<br />

11 Version date-format time-format error code zero separator<br />

character<br />

12 month<br />

(TDATE$)<br />

day<br />

(TDATE$)<br />

year<br />

(TDATE$)<br />

seconds since midnight (TDATE$)<br />

13 time in milliseconds (TIME$) since midnight<br />

14<br />

15 used by common bank version<br />

16<br />

Figure 4–1. AEDIT$: Packet Format<br />

7833 1733–004 4–3


AEDIT$–ASCII Image Composition Editing Package<br />

4.1.2. Packet Generation PROC<br />

The MASM PROC A$EDITPKT generates the AEDIT$ packet. The calling program<br />

supplies the parameters in italics. The parameters in brackets are optional and may be<br />

omitted. If they are omitted, the default value is used.<br />

Calling Sequence<br />

label A$EDITPKT image-length, image-address [‘MSG’,msg];<br />

[‘FPS’, fps] [‘FPR’, fpr] [‘DPC’, dpc];<br />

[‘SPC’, spc] [‘DFT’, date-format] [‘TFT’, time-format];<br />

[‘SEP’, separator-character]<br />

where:<br />

label<br />

The label that identifies the beginning of the AEDIT$ packet.<br />

image-length<br />

The word length of the data area that is to contain the image. The maximum length<br />

is 63 words. If a larger data area is required, set this field to zero and the ilx field to<br />

the word length, with a maximum length of 511 words.<br />

image-address<br />

msg<br />

fps<br />

fpr<br />

The address of the data area where AEDIT$ constructs the image.<br />

The stop character for the A$EMSG and A$EMSGR subroutines. The default is ‘&'.<br />

The number of digits placed to the left of the decimal point for scientific format,<br />

floating-point editing. The default is 1.<br />

The flag for floating-point rounding.<br />

0 Floating-point numbers are not rounded.<br />

1 Floating-point numbers are rounded (default).<br />

Example with fpr = 1:<br />

Input 1.4356<br />

3 digits printed<br />

Result = 1.44<br />

4–4 7833 1733–004


dpc<br />

spc<br />

AEDIT$–ASCII Image Composition Editing Package<br />

The character that separates the mantissa and the exponent for scientific format,<br />

double-precision, floating-point editing. The default is no character used.<br />

The character that separates the mantissa and the exponent for scientific format,<br />

single-precision, floating-point editing. The default is no character used.<br />

date-format<br />

The date format index (0 through 8), corresponding to the date formats listed in<br />

4.2.4. If set to zero, the date is not formatted; only the time is formatted. The<br />

default is 8.<br />

time-format<br />

The time format index (0 through 3), corresponding to the time formats listed in<br />

4.2.4. If set to zero, the time is not formatted; only the date is formatted. The<br />

default is 2.<br />

separator-character<br />

The character used to separate the date and time formats. It may be either a space<br />

(default) or a dash.<br />

Note: The A$EDITPKT proc sets the flag bits (word 2, bits 12 and 13) to 1 and the<br />

version (word 11, bits 0:5) to 1.<br />

4.1.3. Examples<br />

The following examples generate the AEDIT$ packet from MASM programs.<br />

Example 1<br />

$(2)<br />

PACKET A$EDITPKT 20,ASCIILINE . AEDIT$ packet<br />

ASCIILINE $RES 20 . Data area for ASCII image<br />

In example 1, the MASM procedure A$EDITPKT generates the AEDIT$ packet at the<br />

location PACKET in location counter 2. AEDIT$ stores the generated ASCII string in the<br />

20-word data area at location ASCIILINE. All other parameters are set to the default<br />

values.<br />

7833 1733–004 4–5


AEDIT$–ASCII Image Composition Editing Package<br />

Example 2<br />

LINELEN $EQU 33 . Length of ASCII data area<br />

$(4)<br />

LINE $RES LINELEN . Data area for ASCII image<br />

PACKET A$EDITPK LINELEN,LINE ‘DFT’,2 ‘TFT’, 3 . AEDIT$ packet<br />

In example 2, the MASM procedure A$EDITPKT generates the AEDIT$ packet for ASCII<br />

editing with date and time formats. AEDIT$ stores the generated ASCII string in the 33word<br />

data area at location LINE. AEDIT$ uses date format index 2 and time format<br />

index 3. AEDIT$ uses the default values for the msg, fps, fpr, dpc, spc, and separatorcharacter<br />

parameters.<br />

Example 3<br />

BUFLEN $EQU 8 . Length of buffer for f-p number<br />

$(2)<br />

FPNUM $RES BUFLEN . Buffer for floating-point number<br />

FPPKT A$EDITP BUFLEN,FPNUM ‘FPR’,0 ‘DPC’,’D’ . AEDIT$ packet<br />

In example 3, the MASM procedure A$EDITPKT generates the AEDIT$ packet at location<br />

FPPKT. AEDIT$ stores the generated ASCII strings in the eight-word buffer at location<br />

FPNUM. AEDIT$ does not round floating-point numbers and uses a separator character<br />

of 'D'. AEDIT$ uses the default values for the msg, fps, spc, date-format, time-format,<br />

and separator-character parameters.<br />

4.2. Calling Sequence<br />

There are several categories of AEDIT$ routines.<br />

• General-purpose editing routines (see 4.2.1)<br />

• Floating-point editing routines (see 4.2.2)<br />

• Time and date editing routines (see 4.2.3)<br />

• System standard format date and time editing routines (see 4.2.4)<br />

The calling program calls the AEDIT$ routines with MASM PROCs from the element<br />

AEDIT$P. Each routine has a corresponding PROC. The PROCs can call either the<br />

relocatable or common bank version of AEDIT$. The relocatable version is called with an<br />

LMJ on X11 to the relocatable entry point. The common bank version is called with an<br />

IBJ$ on X11 to the common bank entry point or an LMJ on X11 to the common bank<br />

entry point if the Auto Switch method is used.<br />

4–6 7833 1733–004


The general calling format for the AEDIT$ PROCs is<br />

A$Exxxxx [,t] p1,p2<br />

where:<br />

xxxxx<br />

t<br />

p1, p2<br />

Characters for the specific AEDIT$ PROC call.<br />

AEDIT$–ASCII Image Composition Editing Package<br />

The type of call to AEDIT$. This parameter is optional and may be omitted. CB or A,<br />

if specified, must be enclosed by apostrophes.<br />

The possible values of t are<br />

blank Call the relocatable version of AEDIT$. This is the default if t is omitted.<br />

'CB' Call the common bank version of AEDIT$.<br />

'A' Call the common bank version of AEDIT$ using the Auto Switch method.<br />

Parameters specific to the individual PROC call (see Table 4–1, Table 4–2, and<br />

Table 4–3).<br />

A column pointer is maintained by AEDIT$. It is advanced by the number of characters<br />

the calling program inserts when editing. The first column is zero.<br />

Some AEDIT$ PROCs return an error status in register A1. See the individual PROC calls<br />

in Table 4–1, Table 4–2, and Table 4–3 for possible error status codes. Unless<br />

documented, no error status is returned for the PROC calls.<br />

4.2.1. General-Purpose Editing Routines<br />

The calling program must establish an "edit mode" before using the AEDIT$ routines. The<br />

edit mode begins when the A$EDIT PROC is called, and ends when either the A$EDITX<br />

or A$EPRINT PROCs are called.<br />

Edit mode is reestablished by calling the A$EDITR PROC. A$EDITR assumes that a prior<br />

call to the A$EDITX PROC has been made. If A$EDITR is called without a previous call<br />

to A$EDITX results are unpredictable and may be erroneous.<br />

7833 1733–004 4–7


AEDIT$–ASCII Image Composition Editing Package<br />

The sequence which must be used when calling the AEDIT$ routines is<br />

A$EDIT pkt . Establish edit mode.<br />

A$Exxxx p1,p2 . Call the AEDIT$ PROCs<br />

. to perform editing.<br />

A$EDITX . Terminate edit mode (A$EPRINT also<br />

. terminates edit mode).<br />

. .<br />

. . Other processing may take place here.<br />

. .<br />

A$EDITR pkt . Re-establish edit mode.<br />

A$Exxxx p1,p2 . Perform more editing.<br />

A$EDITR . Terminate edit mode (or A$EPRINT<br />

. to print line and terminate).<br />

Table 4–1 describes the AEDIT$ routines to initialize and terminate edit mode. Table 4–2<br />

and Table 4–3 describe the routines that may be called in edit mode.<br />

The AEDIT$ PROCs pass parameters in registers A0 and A1. If the parameters are<br />

omitted on the call, then the corresponding load instructions are not generated, and<br />

AEDIT$ assumes the input data is in the designated registers. The parameters may be<br />

in the instruction word format "*u,*x,j"which may be defined with the MASM $EQUF<br />

directive ("label $EQUF *u,*x,*j") and the $EQUF label specified as the parameter.<br />

Parameters are indicated by p1 and p2 in Table 4–1 and Table 4–2.<br />

4–8 7833 1733–004


AEDIT$–ASCII Image Composition Editing Package<br />

Table 4–1. AEDIT$: Initialization and Termination Editing Routines<br />

PROC Call Generated<br />

Instructions<br />

A$EDIT p1 LA,XU A0,p1<br />

LMJ X11,AEDIT$<br />

A$EDITR p1 LA,XU A0,p1<br />

LMJ X11,AEDITR$<br />

Description<br />

Initialize and establish edit mode.<br />

p1 is the address of the AEDIT$ packet. If p1 is not specified,<br />

the address of the packet must be in A0. S3 of the first word<br />

of the packet is expected to contain the number of words in the<br />

image area, and H2 of the first word of the packet is expected<br />

to contain the location of the image area. The image is set to<br />

blanks, and edit mode is established. The column pointer is set<br />

to the start of the image. AEDIT$ enters quarter-word mode.<br />

AEDIT$ returns a status code in register A1. If A1 is zero, no<br />

error occurred; if A1 is nonzero, an error occurred and AEDIT$<br />

terminates with an ER ERR$. See Table 4–5 for an explanation<br />

of error status codes.<br />

Reenter edit mode without initializing.<br />

A$EDITX LMJ X11,AEDITX$ Terminate edit mode.<br />

A$EPRINT p1 LA,U A0,p1<br />

LMJ X11,AEPRINT$<br />

If p1 is not specified, the address packet must be in register<br />

A0. Edit mode is reestablished, and the column pointer (saved<br />

by AEDITX$) is restored.<br />

The column pointer is saved in the packet. AEDITX$ returns<br />

with the packet address in A0 and the number of words in the<br />

image in A1.<br />

Print image and leave editing mode (call AEDITX$).<br />

Parameter p1 specifies the line spacing for the image. See the<br />

A$EPRINT description in Table 4–2.<br />

7833 1733–004 4–9


AEDIT$–ASCII Image Composition Editing Package<br />

Table 4–2. AEDIT$: General Purpose ASCII Editing Routines<br />

PROC Call Generated<br />

Instructions<br />

A$ECHAR p1 LA,XU A0,p1<br />

LMJ X11,AECHAR$<br />

Description<br />

Insert the character in p1 into the next position of the data<br />

area.<br />

The character contained in Q4 of A0 is inserted into the data<br />

area.<br />

A$ECLEAR LMJ X11,AECLEAR$ Clear the data area for the ASCII image.<br />

The data area is set to blanks and the column pointer is set to<br />

the start of the data area (column zero).<br />

A$ECOLN LMJ X11,AECOLN Compute the current column number.<br />

A$ECOL p1 LA,XU A0,p1<br />

A$ECOPY<br />

p1,p2<br />

A$EDCFZ<br />

p1,p2<br />

A$EDECF<br />

p1,p2<br />

LMJ X11,AECOL$<br />

LA,U A0,p2<br />

LA,U A1,p1<br />

LMJ X11,AECOPY$<br />

LA A0,p2<br />

LA,U A1,p1<br />

LMJ X11,AEDCFZ$<br />

LA A0,p2<br />

LA,U A1,p1<br />

LMJ X11,AEDECF$<br />

A$EDECV p1 LA A0,p1<br />

LMJ X11,AEDECV$<br />

Returns with the column number in A0.<br />

Position to the column specified in p1.<br />

The column pointer is changed to the number specified in p1.<br />

The first character position of the image is column 0.<br />

Copy a string into the data area.<br />

p2 is expected to contain the address of a string of characters.<br />

A character offset for the first word of the string may be<br />

supplied in H1 of register A0. The offset is in the range 0–3<br />

with 0=Q1, 1=Q2, 2=Q3, and 3=Q4 of the first word.<br />

If the character offset is supplied in H1 of register A0, then the<br />

PROC call should not be used. Instead, the calling sequence<br />

should be coded directly. The number of characters in p1 is<br />

copied from this area into the data area.<br />

Edit a decimal number (fixed length with leading zeros).<br />

Edit p2 to a decimal number right-justified in a field of p1<br />

characters. A leading "-" is added if p2 is negative. The result<br />

overflows the field to the right if it does not fit into the<br />

specified field size.<br />

Leading zeros are produced where AEDECF$ would produce<br />

leading spaces. This routine is convenient for editing decimal<br />

fractions.<br />

Edit a decimal number (fixed length).<br />

Edits p2 to a decimal number right-justified in a field of p1<br />

characters. A leading "--" is added if p2 is negative. The result<br />

overflows the field to the right if it does not fit into the<br />

specified field size.<br />

Edit a decimal number (variable length).<br />

Edits p1 to a decimal number. A leading "-" is added if p1 is<br />

negative. The number of characters generated is a function of<br />

the sign and magnitude of p1.<br />

4–10 7833 1733–004


AEDIT$–ASCII Image Composition Editing Package<br />

Table 4–2. AEDIT$: General Purpose ASCII Editing Routines<br />

PROC Call Generated<br />

Instructions<br />

A$EFD1 p1 LA A0,p1<br />

LMJ X11,AEFD1$<br />

A$EFD2 p1 DL A0,p1<br />

LMJ X11,AEFD2$<br />

A$EMSG p1 LA,U A0,p1<br />

LMJ X11,AEMSG$<br />

Description<br />

Insert one word of ASCII characters.<br />

The four characters in p1 are inserted into the image. ASCII<br />

spaces (040) and null characters (000) are ignored.<br />

Insert two words of ASCII characters.<br />

The eight characters in p1 are inserted into the data area.<br />

Blanks and null characters are ignored.<br />

Message editor initial entry.<br />

A$EMSGR LMJ X11,AEMSGR$ Message editor reentry.<br />

A$EOCTF<br />

p1,p2<br />

LA A0,p2<br />

LA,U A1,p1<br />

LMJ X11,AEOCTF$<br />

A$EOCTV p1 LA A0,p1<br />

A$EPACK<br />

p1,p2<br />

LMJ X11,AEOCTV$<br />

LA,U A0,p2<br />

LA,U A1,p1<br />

LMJ X11,AEPACK$<br />

Copies the characters starting at the address given in p1 into<br />

the data area. This process stops when the character in Q1 of<br />

the sixth word of the packet (stop character) is found. The<br />

pointer to the string is saved in the packet.<br />

The string at address p1 must contain at least one stop<br />

character. A character offset for the first word of the string<br />

may be supplied in H1 of register A0. The offset is in the<br />

range 0–3 with 0=Q1,1=Q2, 2=Q3, and 3=Q4 of the first<br />

word.<br />

If the character offset is supplied in H1 of register A0, then the<br />

PROC call should not be used. Instead, the calling sequence<br />

should be coded directly.<br />

This routine performs the same operation as AEMSG$ except<br />

that the pointer to the input string is taken from the packet.<br />

With these two routines, it is possible to copy a string into the<br />

data area, occasionally interrupting this process to perform<br />

other editing functions at certain selected points in the string.<br />

Edit an octal number (fixed length).<br />

Edits p2 to p1 octal digits. Leading zeros are not suppressed.<br />

P1 must not exceed 12.<br />

Edit an octal number (variable length).<br />

Edits contents of p1 to octal. The number of digits edited<br />

depends on the size of the number. If the number is greater<br />

than seven, a leading zero is added.<br />

Copy and pack a string.<br />

Same as A$ECOPY except that null (000) characters are<br />

ignored. A$QPACK removes the null (000) characters from the<br />

output string while A$ECOPY retains them. Null characters do<br />

not show up in the printed line.<br />

7833 1733–004 4–11


AEDIT$–ASCII Image Composition Editing Package<br />

Table 4–2. AEDIT$: General Purpose ASCII Editing Routines<br />

PROC Call Generated<br />

Instructions<br />

A$EPACK<br />

p1,p2<br />

A$EPRINT p1 LA,U A0,p1<br />

LA,U A0,p2 Copy and pack a string.<br />

LMJ X11,AEPRINT$<br />

A$ESKIP p1 LA,XU A0,p1<br />

LMJ X11,AESKIP$<br />

Print image line and AEDITX$.<br />

Description<br />

The image pointed to by the image location in the packet is<br />

printed and AEDITX$ performed. The line spacing is given in<br />

p1. If the parameter is omitted, a value of one is used.<br />

The AEDIT$ routines do not limit the size of the image that can<br />

be created. However, the size of the image that can be<br />

printed is limited by both the AEPRINT$ routine and the<br />

current print width.<br />

The AEPRINT$ routine has a limit of 63 words or 252 ASCII<br />

characters. If the image contains more than 63 words,<br />

AEPRINT$ prints the first 63 words and ignores the extra<br />

words.<br />

The print width is a control parameter for the Exec printer<br />

handlers. If the length of the image is greater than the current<br />

print width, a type 02 (SYMB) code 04 (SDF image length<br />

error) contingency occurs.<br />

The standard default value for print width is 33 words or 132<br />

ASCII characters. To print an image larger than this, you must<br />

increase the print width by using the print control 'W' function.<br />

Refer to the Exec Request <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for<br />

a description of the print control functions.<br />

Note: To establish the print width for the maximum size<br />

image that can be output by AEPRINT$ (63 words or 252 ASCII<br />

characters), issue a print control "W,42" function. With this<br />

print width, no contingency due to length error will ever occur<br />

when using AEPRINT$. This is because AEPRINT$ prints a<br />

maximum of 63 words of image data and ignores any words<br />

beyond 63.<br />

Advance the column pointer.<br />

The number given in p1 is added to the column pointer.<br />

p1 may be negative.<br />

4–12 7833 1733–004


AEDIT$–ASCII Image Composition Editing Package<br />

Example<br />

The following example shows a MASM program that generates an ASCII string by calling<br />

the relocatable version of AEDIT$.<br />

$ASCII<br />

$INCLUDE ‘MAXR$’<br />

$(2)<br />

LINE $RES 20 . Data area for image<br />

PACKET A$EDITPKT 20,LINE . AEDIT$ packet<br />

STRING ‘The contents of variable’ . ASCII character string<br />

VAR ‘ADDRESS’ . Variable name<br />

VALUE + 02741 . Octal value for variable<br />

$(1)<br />

START<br />

A$EDIT PACKET . Initialize and enter ASCII editing mode<br />

A$ECOL 10 . Move to column 10<br />

A$ECOPY 24,STRING . Copy 24 characters from string to the data area<br />

A$ECHAR ‘


AEDIT$–ASCII Image Composition Editing Package<br />

4.2.2. Floating-Point Editing Routines<br />

AEDIT$F edits floating-point numbers into one of two general formats.<br />

• Fixed decimal format (no exponent)<br />

• Scientific format<br />

Fixed Decimal Format<br />

A number edited in fixed decimal format consists of a sign (if negative) followed by the<br />

digits of the number with an embedded decimal point. The sign is present only if the<br />

number is negative; a positive number has no sign character.<br />

The floating-point editing routines require three parameters in addition to the address of<br />

the floating-point packet. The first two are called x and y and are supplied in S5 and S6<br />

of register A0. They specify the format of the edited number as described below. The<br />

third parameter is the single- or double-precision number to be edited. If single<br />

precision, the number is specified in A1; if double precision, the number is specified in<br />

registers A1 and A2.<br />

The x parameter specifies the width of the edited field; in other words, the number of<br />

character positions that the edited number will occupy, including sign and decimal point.<br />

If the value of x is too small to represent the value being edited, it is ignored, and as<br />

many character positions are used as are required to correctly represent the number.<br />

The y parameter specifies how many fractional digits will be edited. This is the number<br />

of digits appearing to the right of the decimal point. The value of y may be any value<br />

greater than or equal to zero, but should always be less than the value of x to allow for<br />

the sign and decimal point characters.<br />

The maximum number of significant digits for which the floating-point routines can<br />

generate correct results in the fixed decimal format is 8 for single-precision numbers and<br />

17 for double precision. It includes digits on both the sides of the decimal point. This is<br />

because the 2200 single-precision floating-point format uses 27 bits for mantissa which<br />

can represent up to 8 decimal digits. The double-precision floating-point format uses 60<br />

bits for the mantissa which can represent up to 18 decimal digits. Rounding can be done<br />

at a maximum of the 18th digit. This will provide rounded results up to 17 digits. If the<br />

rounding option has been set with a value of y greater than 17 rounding will not be done<br />

by these routines.<br />

For example, the following numbers are in fixed decimal format:<br />

258.61 Requires parameter values of x > 6 and y = 2.<br />

-85.2239 Requires parameter values of x > 8 and y = 4.<br />

1093. Requires parameter values of x > 5 and y = 0.<br />

4–14 7833 1733–004


AEDIT$–ASCII Image Composition Editing Package<br />

Scientific Format<br />

The scientific format is similar to the fixed decimal format, but it has an exponent at the<br />

right. The exponent consists of an optional exponent character (usually 'E' for singleprecision<br />

and 'D' for double-precision numbers) followed by the exponent's sign (either<br />

"+" or "-") and the exponent's digits. Exponents of single-precision numbers are always<br />

edited as a 2-digit value, and those of double-precision numbers are always edited as a<br />

3–digit value.<br />

The x parameter specifies the total number of character positions to be occupied by the<br />

edited number, including signs, digits, decimal point, and exponent character. If the<br />

edited numbers require more character positions than are specified by the value of x, the<br />

x parameter is ignored and the required character positions are used.<br />

The y parameter specifies the total number of mantissa digits to appear in the edited<br />

number. It includes the digits on both sides of the decimal point but not the decimal<br />

point itself. The placement of the decimal point within the y digits of the mantissa is<br />

determined by the value in the packet cell fps. This is the number of digits to appear to<br />

the left of the decimal point. It is normally set to one.<br />

The floating-point routines provide rounding up to 8 significant digits for single-precision<br />

floating-point numbers and 17 significant digits for double-precision floating-point<br />

numbers. This is because the 2200 single-precision and the double-precision formats<br />

use 27 and 60 bits for the mantissa, respectively. These can represent up to 8 and 18<br />

significant digits in these cases. As rounding is done at a maximum of the 18th digit, the<br />

maximum value of y for which a rounded result will be produced is 8 for single-precision<br />

and 17 for double-precision floating-point numbers. The value of x should allow for the<br />

sign, decimal point, the exponent character, the exponent sign, and the exponent digits.<br />

For example, the following numbers are in scientific format:<br />

8.66E+01 Requires parameter values of x ≥ 8 and y = 3.<br />

-1.3375E-10 Requires parameter values of x ≥ 11 and y = 5.<br />

5.164D+003 Requires parameter values of x ≥ 10 and y = 4.<br />

7833 1733–004 4–15


AEDIT$–ASCII Image Composition Editing Package<br />

4.2.2.1. Calling Procedures for the Floating-Point Editing Routines<br />

Table 4–3 describes the floating-point editing routines and the procedures used to call<br />

them.<br />

Table 4–3. AEDIT$F: Floating-Point ASCII Editing Routines<br />

PROC Call Generated<br />

Instructions<br />

A$EFLF1 x*/6+y,p LA A1,p<br />

LA,U A0,x*/6+y<br />

LMJ X11,AEFLF1$<br />

A$EFLF2 x*/6+y,p DL A1,p<br />

LA,U A0,x*/6+y<br />

LMJ X11,AEFLF2$<br />

A$EFLG1 x*/6+y,p LA A1,p<br />

LA,U A0,x*/6+y<br />

LMJ X11,AEFLG1$<br />

A$EFLG2 x*/6+y,p DL A1,p<br />

LA,U A0,x*/6+y<br />

LMJ X11,AEFLG2$<br />

A$EFLS1 x*/6+y,p LA A1,p<br />

LA,U A0,x*/6+y<br />

LMJ X11,AEFLS1$<br />

A$EFLS2 x*/6+y,p DL A1,p<br />

LA,U A0,x*/6+y<br />

LMJ X11,AEFLS2$<br />

Description<br />

Single-precision fixed decimal format.<br />

The floating-point number p is edited to fixed<br />

decimal format with y digits following the decimal<br />

point, right-justified, in a field of size x.<br />

Double-precision fixed decimal format.<br />

The floating-point number p is edited to fixed<br />

decimal format with y digits following the decimal<br />

point, right-justified, in a field of size x.<br />

Single-precision generalized format.<br />

Same as scientific format except that an attempt is<br />

made to move the decimal point in such a way as to<br />

reduce the exponent to zero. If this can be done,<br />

the exponent is set to blanks. Otherwise scientific<br />

format is used.<br />

Double-precision generalized format.<br />

See AEFLG1$ and AEFLS2$.<br />

Single-precision scientific format.<br />

The floating-point number p is edited to scientific<br />

format with y significant digits in a field size of x.<br />

The exponent is two digits long.<br />

Double-precision scientific format.<br />

The floating-point number p is edited to scientific<br />

format with y significant digits in a field size of x.<br />

The exponent is three digits long.<br />

4–16 7833 1733–004


4.2.2.2. Example<br />

AEDIT$–ASCII Image Composition Editing Package<br />

The following example shows a MASM program that generates an ASCII string<br />

containing floating-point numbers with the common bank version of AEDIT$.<br />

$ASCII<br />

$INCLUDE ‘MAXR$’<br />

$(2)<br />

PACKET A$EDITPKT 20,LINE ‘FPS’,0 ‘SPC’,’E’ . AEDIT$ packet<br />

LINE $RES 20 . Image buffer<br />

DIVIDEND + 1.0 . Floating-point 1.0<br />

DEC1 + 1 . Integer 1<br />

DIVISOR + 32.0 . Floating-point 32.0<br />

DEC32 + 32 . Integer 32<br />

QUOTIENT + 0 . Quotient location<br />

STRING ‘ divided by ‘<br />

$(1)<br />

START<br />

A$EDIT,’CB’ PACKET . Enter ASCII edit mode<br />

A$EDECV,’CB’ DEC1 . Edit ASCII ‘1’<br />

A$ECOPY,’CB’ 12,STRING . Copy 12 characters<br />

A$EDECV,’CB’ DEC32 . Edit ASCII ‘32’<br />

A$ECHAR,’CB’ ‘


AEDIT$–ASCII Image Composition Editing Package<br />

The floating-point number at location DIVIDEND is divided by the floating-point number<br />

at location DIVISOR and stored at the location QUOTIENT. The A$EFLS1 procedure<br />

edits the quotient into scientific format. The total number of characters used is 11. Five<br />

of these characters are used for digits.<br />

The A$EPRINT procedure prints the image generated at location LINE by executing an<br />

ER APRINT$ and exits edit mode.<br />

4.2.3. Time and Date Editing Routines<br />

PROC Call<br />

A$EDAY1 p1<br />

A$EDAT1<br />

A$EDAY2 p1<br />

A$EDAT2<br />

A$EDAY3 p1<br />

A$EDAT3<br />

AEDIT$T provides ASCII time and date editing to common formats.<br />

Each of these functions accepts input in ER TDATE$ format. (See the Exec ER<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.)<br />

month day year (relative to<br />

1964)<br />

number of seconds since midnight<br />

Table 4–4. AEDIT$T: ASCII Time and Date Editing Routines<br />

Generated<br />

Instructions<br />

LA A0,p1<br />

LMJ X11,AEDAY1$<br />

ER TDATE$<br />

LMJ X11,AEDAY1$<br />

LA A0,p1<br />

LMJ X11,AEDAY2$<br />

ER TDATE$<br />

LMJ X11,AEDAY2$<br />

LA A0,p1<br />

LMJ X11,AEDAY3$<br />

ER TDATE$<br />

LMJ X11,AEDAY3$<br />

Description<br />

Edits the date portion of A0 into the format<br />

mm/dd/yy<br />

where mm, dd, yy are the 2 digits of the month, day, and year,<br />

respectively.<br />

Edits the date portion of A0 into the format<br />

dd mmm yy<br />

where dd and yy are the 2 digits of the day and year,<br />

respectively, and mmm is a 3-character abbreviation for the<br />

month.<br />

Edits the date portion of A0 into the format<br />

month dd, year<br />

where month is the name of the month (up to 9 characters), dd is<br />

the day (1 or 2 characters), and year is the 4-digit year.<br />

4–18 7833 1733–004


PROC Call<br />

A$EDAY4 p1<br />

A$EDAT4<br />

A$EDAY5 p1<br />

A$EDAT5<br />

A$ETIME p1<br />

A$ETD<br />

AEDIT$–ASCII Image Composition Editing Package<br />

Table 4–4. AEDIT$T: ASCII Time and Date Editing Routines<br />

Generated<br />

Instructions<br />

LA A0,p1<br />

LMJ X11,AEDAY4$<br />

ER TDATE$<br />

LMJ X11,AEDAY4$<br />

LA A0,p1<br />

LMJ X11,AEDAY5$<br />

ER TDATE$<br />

LMJ X11,AEDAY5$<br />

LA A0,p1<br />

LMJ X11,AETIME$<br />

ER TDATE$<br />

LMJ X11,AETIME$<br />

Description<br />

Edits the date portion of A0 into the format<br />

yearmmdd<br />

where year is the 4-digit year, and mm and dd are the 2 digits of<br />

the month and day, respectively.<br />

Edits the date portion of A0 into the format<br />

yymmdd<br />

where yy, mm, and dd are the 2 digits of the year, month, and<br />

day, respectively.<br />

Edits the time portion of A0 into the format<br />

hh:mm:ss<br />

where hh, mm, and ss are the 2 digits of the hours, minutes, and<br />

seconds of the time, respectively.<br />

4.2.4. Standard Format Date and Time Editing Routines<br />

AEDIT$SFDT is a routine that creates an ASCII string using standard formats for date and<br />

time. The current date and time (or caller-specified date and time) are converted into an<br />

ASCII string and placed into the buffer that the calling program provides. This routine is<br />

used like the other AEDIT$ routines.<br />

There are eight system standard date formats and three system standard time formats:<br />

Date Formats Time Formats<br />

1. YYMMDD 1. HHMM<br />

2. CCYYMMDD 2. HHMM:SS<br />

3. YY-MM-DD 3. HHMM:SS.FFF<br />

4. CCYY-MM-DD<br />

5. YY mmm DD<br />

6. CCYY mmm DD<br />

7. YY mmm DD ddd<br />

8. CCYY mmm DD ddd<br />

7833 1733–004 4–19


AEDIT$–ASCII Image Composition Editing Package<br />

where:<br />

CC<br />

YY<br />

MM<br />

DD<br />

HH<br />

MM<br />

SS<br />

FF<br />

mmm<br />

ddd<br />

Two-digit decimal century<br />

Two-digit decimal year of century<br />

Two-digit decimal month<br />

Two-digit decimal day of month<br />

Two-digit decimal hour<br />

Two-digit decimal minute<br />

Two-digit decimal second<br />

Three-digit decimal fractional second (only significant digits included)<br />

Three ASCII character abbreviation for month (see 22.3, SFDTBL$)<br />

Three ASCII character abbreviation for day of week (see 22.3, SFDTBL$)<br />

The calling program can edit an individual date, individual time, or combined date and<br />

time format. If combined together, the date format precedes the time format, and the<br />

date and time are separated by either a space character (' ') or a dash character ('–'). The<br />

space character separator may be used with all formats. The dash character separator<br />

may only be used with date formats 1 through 4.<br />

4–20 7833 1733–004


4.2.4.1. Recommended Date and Time Formats<br />

AEDIT$–ASCII Image Composition Editing Package<br />

Since there are many possible date and time format combinations, the following formats<br />

are recommended as standard:<br />

YYMMDD HHMM:SS format (1,2) (most compact)<br />

CCYY-MM-DD HHMM:SS format (4,2)<br />

CCYY mmm DD ddd HHMM:SS format (8,2) (most descriptive)<br />

The element SFDTBL$ contains the ASCII character abbreviations for months and days.<br />

It is accessed by the external label SFDTBL$. These abbreviations may be changed to<br />

other abbreviations for months and days, for example, when using languages other than<br />

English.<br />

4.2.4.2. Calling Procedure for Date and Time Editing<br />

The following procedure calls the ASCII system standard format date and time editing<br />

routine:<br />

A$ESFDT[,t] [date] [time]<br />

error return<br />

normal return<br />

where:<br />

t<br />

date<br />

The type of call to AEDIT$SFDT: This parameter is optional and may be omitted.<br />

CB or A, if specified, must be enclosed by apostrophes.<br />

blank<br />

'CB'<br />

'A'<br />

Call the relocatable version of AEDIT$SFDT. This is the default if t is omitted.<br />

Call the common bank version of AEDIT$SFDT.<br />

Call the common bank version of AEDIT$SFDT using the Auto Switch method.<br />

The address of a caller-specified date and time. If specified, it must be in TDATE$<br />

format. This parameter is optional.<br />

7833 1733–004 4–21


AEDIT$–ASCII Image Composition Editing Package<br />

time<br />

The address of a caller-specified time. If specified, it must be in TIME$ format.<br />

This parameter is optional.<br />

If date or time are not included on the calling statement, the current date and time is<br />

used (from ER TDATE$ or current time from ER TIME$ for time format 3). Indexing,<br />

incrementation, indirect addressing, and j-designator selection in the format “*u,*x,j”<br />

may be used to specify date and time if they are defined with the MASM $EQUF<br />

directive ("label $EQUF *u,*x,j") and the $EQUF label is specified as the parameter.<br />

The calling program specifies the date format index and time format index in the AEDIT$<br />

packet. See 4.1.1.<br />

If an error occurs, the error return is taken, and register A1 contains one of the error<br />

codes in Table 4–5. The code is also stored in the packet in field “error code” (see<br />

4.1.1).<br />

If the normal return is taken, the date and time string has been successfully stored in the<br />

caller's data area.<br />

The generated instructions for the relocatable call, if both date and time parameters are<br />

present:<br />

L A0,date<br />

L A1,time<br />

LMJ X11,AESFDT$<br />

4–22 7833 1733–004


4.2.4.3. Example<br />

AEDIT$–ASCII Image Composition Editing Package<br />

The following example shows a MASM program that creates an ASCII string with date<br />

and time formats using the relocatable version of AEDIT$.<br />

$ASCII<br />

$INCLUDE ‘MAXR$’<br />

$(2)<br />

PKT A$EDITPKT 15,DATELINE ‘DFT’,8 ‘TFT’,3 . AEDIT$ packet<br />

DATELINE $RES 15 . Image buffer<br />

MSG ‘Current date and time:’ . Output string<br />

$(1)<br />

START<br />

A$EDIT PKT . Enter edit mode<br />

A$ECOPY 23,MSG . Copy 23 character string<br />

A$ESFDT . Edit the date and time<br />

J ERROR . Jump if error occurred<br />

A$EPRINT . Print out edited string<br />

J DONE .<br />

ERROR . Error return<br />

L$SNAP ‘SFDT’,2 . Dump A-registers<br />

DONE .<br />

ER EXIT$<br />

$END START<br />

This MASM program calls the relocatable version of AEDIT$ to create and print the<br />

following ASCII string:<br />

Current date and time: 1983 Sep 10 Sat 1643:14.057<br />

In this example, AEDIT$ generates the ASCII string in the 15-word data area DATELINE.<br />

The AEDIT$ packet is generated by the A$EDITPKT procedure using date format 8 and<br />

time format 3.<br />

The A$EDIT procedure initializes the AEDIT$ packet at location PKT and enters edit<br />

mode. The A$ECOPY procedure copies 23 characters from location MSG to the data<br />

area (including one space character following the colon). The A$ESFDT procedure call<br />

generates the standard date and time format string in the data area. Since no date or<br />

time parameters are specified on the A$ESFDT procedure call, the current date and time<br />

are used.<br />

If A$ESFDT takes the error return, the A-registers are dumped by the L$SNAP procedure<br />

call. Otherwise, the A$EPRINT procedure prints the image generated at location<br />

DATELINE by executing an ER APRINT$. Edit mode is then exited.<br />

7833 1733–004 4–23


AEDIT$–ASCII Image Composition Editing Package<br />

4.2.5. Error Status Codes<br />

The status codes listed in Table 4–5 are returned in register A1 when an error occurs in<br />

some of the AEDIT$ routines.<br />

Table 4–5. AEDIT$: Error Status Codes<br />

Octal Code Status<br />

0 Normal return from A$ESFDT.<br />

01 A prelevel 75R1 <strong>SYSLIB</strong> AEDIT$ packet format is being used.<br />

02 An outdated version of the AEDIT$ packet is being used.<br />

03 The date format index is out of range.<br />

04 The time format index is out of range.<br />

05 Both of the date and time formats are zero.<br />

06 The common bank version of AEDIT$ is being called without<br />

using the A$EDITPKT PROC to generate the AEDIT$ packet.<br />

4–24 7833 1733–004


4.2.6. Examples<br />

AEDIT$–ASCII Image Composition Editing Package<br />

The following table contains examples of AEDIT$ PROC calls and the instructions that<br />

the PROC call generates.<br />

Procedure Call Generated Instructions<br />

A$ECHAR ‘A’ LA,U A0,’A’<br />

LMJ X11,AECHAR$<br />

A$ECHAR *TAG,X6,S5 LA,S5 A0,*TAG,X6<br />

LMJ X11,AECHAR$<br />

A$ECHAR,’CB’ I$BJ X11,CBAECHAR$<br />

A$EDECV COUNT,,H2 LA,H2 A0,COUNT<br />

LMJ X11,AEDECV$<br />

A$EDECV LMJ X11,AEDECV$<br />

A$ECOPY 50,LINE LA,U A0,LINE<br />

LA,U A1,50<br />

LMJ X11,AECOPY$<br />

A$ECOPY 50,TAB,X6,W LA A0,TAB,X6<br />

LA,U A1,50<br />

LMJ X11,AECOPY$<br />

A$ECOPY COUNT LA,U A1,COUNT<br />

LMJ X11,AECOPY$<br />

A$EDECF,’A’ 10,COUNT LA A0,COUNT<br />

LA,U A1,10<br />

LMJ X11,CBAEDECF$-1<br />

A$EFLF2 30*/6+18,(1.234D) DL A1,(1.234D)<br />

LA,U A0,30*/6+18<br />

LMJ X11,AEFLF2$<br />

A$EFLF1 20*/6+9 LA,U A0,20*/6+9<br />

LMJ X11,AEFLF1$<br />

7833 1733–004 4–25


AEDIT$–ASCII Image Composition Editing Package<br />

4–26 7833 1733–004


Section 5<br />

BSP$-Program File Basic Service<br />

Package<br />

The Basic Service Package (BSP$) provides an interface between the calling program<br />

and the table of contents (TOC) of a program file.<br />

The program file format is described in the Data Structures <strong>Programming</strong> <strong>Reference</strong><br />

<strong>Manual</strong>. The file table index (FTI) is the control part of the program file. Figure 5-1<br />

contains a general description of the FTI. The FTI describes five tables that are accessed<br />

by the BSP$ functions.<br />

• Element table<br />

• Assembler procedure table<br />

• COBOL procedure table<br />

• FORTRAN/PLUS procedure table<br />

• Relocatable element entry point table<br />

The part of the program file occupied by the five tables is called the TOC.<br />

BSP$ performs the following functions:<br />

• Reads the FTI into a buffer.<br />

• Reads a selected program file table into a buffer.<br />

• Searches a selected program file table for a specific entry.<br />

• Deletes a specific entry in a program file table.<br />

• Locates a program file table entry from its sequence number in the table.<br />

• Changes a specific entry in a program file table.<br />

• Adds an entry to a program file table.<br />

• Writes the last entry referenced back to the file.<br />

• Marks the last entry referenced in a program file table as having been updated.<br />

• Writes a program file table back to the file.<br />

• Writes the FTI back to the file.<br />

Reading the FTI of a previously unwritten file changes that file to a program file. The<br />

table is not written to the file until BSP$ writes the FTI.<br />

7833 1733–004 5–1


BSP$-Program File Basic Service Package<br />

Some guidelines concerning the use of BSP$ are the following:<br />

• There are two basic program file formats. The standard program file (PF) has small<br />

variable-length tables. The large program file (LPF) has large fixed-length tables. For<br />

example, the PF has a normal maximum of 2,671 element table entries that can be<br />

expanded to 5,000 entries, while the LPF has a fixed maximum of 26,146 element<br />

table entries.<br />

• PF and LPF elements are limited to a maximum of 262,143 sectors of text for each<br />

element. A new program file type, the large element program file (LEPF) removes<br />

this limitation and allows elements to have over 262,143 sectors of text, if desired.<br />

An LEPF can be initialized with the small variable-length format of a standard<br />

program file (standard LEPF) or with the large fixed-length format of a large program<br />

file (large LEPF).<br />

• If the calling program attempts to create a program file in a file area in which a file<br />

was previously written, the calling program will receive an error return if the first<br />

word encountered is not the program file identifier constant or if sector 0 is not all<br />

zeros.<br />

• For standard PF format, each table on mass storage begins at the system-defined<br />

sector or at a greater sector if a previous table occupies the defined sector. The<br />

element table always starts at the system-defined sector. The system-defined<br />

sectors and starting sector for element text are the six ‘PFxx$' equates in element<br />

SYS$DEF (see Table 2–4).<br />

• For LPF formats, each table on mass storage begins at the system-defined sector.<br />

The system-defined sectors and starting sector for element text are the six 'LPF$xx'<br />

equates in element SYS$DEF (see Table 2–4).<br />

• For standard PF formats, the system default TOC size is 1,792 sectors (28 tracks).<br />

For LPF formats, the system default TOC size is 40,256 sectors (629 tracks).<br />

• The calling program must provide a 43-word data area (for BSP$). This area is<br />

referred to as the file control table (FCT). The calling program must also provide<br />

main storage buffers for each table read.<br />

• The calling program must request to read the FTI before any other BSP$ functions<br />

are called. The FTI must be in the BSP$ FCT until all BSP$ functions are executed.<br />

• The FTI part of the FCT data area is used by BSP$ to contain necessary information<br />

about the file.<br />

• A table must be read into the caller’s buffer (RPFxxT$ calls) before any operations<br />

are performed on the table.<br />

• BSP$ returns an error code if a table cannot hold another item.<br />

• A table must be written back from the caller's buffer (WPFxxT$ calls) before the<br />

buffer can be used to hold another table.<br />

• BSP$ operates most efficiently when the caller’s buffer is large enough to contain<br />

the entire program file table, including the size of entries to be added to the table.<br />

The current length of each program file is available when the FTI is read.<br />

• Each table that has been modified must be written back to the program file table of<br />

contents on mass storage.<br />

5–2 7833 1733–004


BSP$-Program File Basic Service Package<br />

BSP$ is available in both the <strong>SYSLIB</strong> common bank <strong>SYSLIB</strong>$1 and as a relocatable<br />

element in the <strong>SYSLIB</strong> installation file (SYS$LIB$*<strong>SYSLIB</strong>). The relocatable and common<br />

bank entry points to BSP$ are listed in Appendix E.<br />

5.1. BSP$ Functions<br />

The following descriptions of the BSP$ functions include three calling methods:<br />

relocatable, common bank, and Auto Switch. Entry points to the common bank BSP$<br />

are the same as the relocatble entry points except they are prefixed with the letters CB.<br />

Section 3 describes the <strong>SYSLIB</strong> access methods.<br />

Some BSP$ functions require that the address of a packet be passed as a parameter.<br />

In those cases, a diagram shows the format of the packet. If a field name is italicized,<br />

the caller must provide a value for the field. All element, version, and procedure names<br />

are 12 Fieldata characters, left-justified and space-filled. DF is the delete flag and is set<br />

to one for deleted items. CI is the continuation indicator and is set to one for COBOL<br />

procedure names longer than 12 characters.<br />

5.1.1. Read FTI<br />

The FTI must be read into the data area provided by the caller for the FCT before any<br />

other operations can be performed. If any add, delete, or change operations are<br />

completed, then a WFTI$ call must be done to write the FTI back to the file.<br />

Two functions are available to read the FTI. The RFTI$ function can be used to read an<br />

existing PF or LPF and to initialize an empty file as a PF. The RFTI$$ function, described<br />

later in this section, can be used to read an existing PF, LPF, or LEPF and to initialize an<br />

empty file as a PF, LPF, or LEPF.<br />

The following describes the RFTI$ function:<br />

Calling Sequence<br />

Auto Switch<br />

L,U A0,address-of-FCT<br />

LMJ X11,CBRFTI$-1<br />

error return<br />

normal return<br />

Common Bank or<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

I$BJ X11,CBRFTI$<br />

error return<br />

normal return<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

LMJ X11,RFTI$<br />

error return<br />

normal return<br />

7833 1733–004 5–3


BSP$-Program File Basic Service Package<br />

Parameters<br />

address-of-FCT<br />

Address of data area for BSP$. This data area requires 43 words. Words 0 and 1<br />

must contain an internal file name that is in the Fieldata character set, left-justified,<br />

and space-filled. This data area is referred to as the FCT, and must not be modified<br />

between calls to BSP$ after it has been initialized by RFTI$.<br />

Returns<br />

error return<br />

A0 has one of the following values:<br />

02<br />

04<br />

05<br />

07<br />

010<br />

File is not a program file.<br />

File is not assigned to the run or is not a sector formatted mass storage file.<br />

Program file does not contain a supported revision level.<br />

No starting sector address for large program file table.<br />

Program file does not contain a valid size indicator.<br />

07700000000nn<br />

normal return<br />

nn is error status from ER IOW$.<br />

The FTI is stored in the file control table starting at word FCT+6. The FTI is initialized<br />

in the FCT if an I/O status 05 was returned as RFTI$ attempted to read from the file<br />

name specified in words 0 and 1 of the FCT. If the caller is going to be adding an<br />

element to the file, the next sector location for writing the text of the element is<br />

found at word FCT + 7.<br />

On return, A1, S6 (bits 30 through 35) has the FTI size indicator. A PF will have a<br />

value of 0. An LPF will have a value of 4. A1, bit 29 (octal 0100) is the large-element<br />

text-allowed bit. Since RFTI$ can only be used to access a PF or LPF, bit 29 is<br />

always zero (clear). A1 bits 0 through 28 are always zero.<br />

5–4 7833 1733–004


BSP$-Program File Basic Service Package<br />

Figure 5–1 indicates the arrangement of the program file control table after the FTI is<br />

read.<br />

Figure 5–1. BSP$: File Control Table (FCT)<br />

7833 1733–004 5–5


BSP$-Program File Basic Service Package<br />

The following describes the RFTI$$ function:<br />

Calling sequence<br />

Auto Switch<br />

L,U A0,address-of-FCT<br />

L A1,(BSP$-int-level, lengthof-FCT)<br />

L,U A2,[large-elt text++]sizeindicator<br />

LMJ X11,CBRFTI$$-1<br />

error return<br />

normal return<br />

Parameters<br />

address-of-FCT<br />

Common Bank or<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

A1(BSP$-int-level, lengthof-FCT)<br />

L,U A2,[large-elt text++]sizeindicator<br />

I$BJ X11,CBRFTI$$<br />

error return<br />

normal return<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

L,U A1,(BSP$-int-level, lengthof-FCT)<br />

LMJ A2,[large-elt text++]sizeindicator<br />

LMJ X11,RFTI$$<br />

error return<br />

normal return<br />

Address of data area for BSP$. This data area requires at least 43 words. A data<br />

area of 56 words is recommended to accommodate future BSP$ expansion. Words<br />

0 and 1 of this data area must contain an internal file name that is in Fieldata, leftjustified,<br />

and space-filled. This data area is referred to as the file control table (FCT)<br />

and must not be modified between calls to BSP$ after it has been initialized by<br />

RFTI$$.<br />

BSP$-int-level<br />

The BSP$ interface level required by the calling program. The following values may<br />

be specified:<br />

0 This is the only value supported prior to <strong>SYSLIB</strong> 76R1. It allows access to an<br />

existing PF or LPF and allows an empty file to be initialized as a PF or LPF.<br />

1 This value allows access to an existing PF, LPF or LEPF and allows an empty<br />

file to be initialized as a PF, LPF or LEPF. Note that special care must be<br />

taken when processing elements and element text in an LEPF. See sections<br />

5.1.7 and 5.3 for additional information.<br />

2 This value is supported beginning with <strong>SYSLIB</strong> 76R3. Allows the same file<br />

access and initialization as interface level 1. In addition, returns an indication if<br />

the program file was initialized on this function call.<br />

length-of-FCT<br />

Length in words of the data area provided in register A0.<br />

5–6 7833 1733–004


large-elt-text<br />

BSP$-Program File Basic Service Package<br />

The optional large-element text-allowed control bit is bit 29 (octal 0100) in register<br />

A2. It is used by BSP$ only if an empty file is to be initialized as a program file. If bit<br />

29 is zero (clear), the program file is initialized as a PF or an LPF (as specified by<br />

size-indicator) and elements are limited to 262,143 sectors of element text each. If<br />

this bit is one (set), the program file is initialized as a standard LEPF or a large LEPF<br />

(as specified by size-indicator) and elements are allowed to have over 262,143<br />

sectors of element text each. Note that bit 29 cannot be set unless BSP$ interface<br />

level is at least 1.<br />

size-indicator<br />

Size-indicator is in register A2, S6 (bits 30 through 35). It is used by BSP$ only if an<br />

empty file is to be initialized as a program file and its value determines the format of<br />

the program file. The following values may be specified:<br />

0 Standard PF format.<br />

1 Alternate, unsupported standard PF format. A value of 0 will be substituted.<br />

2 Alternate, unsupported LPF format. A value of 4 will be substituted.<br />

3 Alternate, unsupported LPF format. A value of 4 will be substituted.<br />

4 LPF format.<br />

For values 0 and 1, an empty file will be initialized as a PF if large-elt-text is clear and<br />

as a standard LEPF if large-elt-text is set and if BSP$-int-level is at least 1. For values<br />

2, 3, and 4, an empty file will be initialized as an LPF if large-elt-text is clear and as a<br />

large LEPF if large-elt-text is set and if BSP$-int-level is at least 1.<br />

Returns<br />

error return<br />

A0 has one of the following values:<br />

01<br />

02<br />

03<br />

Specified length of data area for FCT (length-of-FCT) is less than the minimum<br />

required.<br />

File is not a PF.<br />

Specified BSP$ interface level (BSP$-int-level) is not supported by this level of<br />

<strong>SYSLIB</strong>.<br />

7833 1733–004 5–7


BSP$-Program File Basic Service Package<br />

04<br />

05<br />

06<br />

07<br />

010<br />

File is not assigned to the run or is not a sector formatted mass storage file.<br />

PF does not contain a supported revision level.<br />

Specified size indicator (size-indicator) is illegal.<br />

No starting sector address for LPF table.<br />

PF does not contain a valid size indicator.<br />

07700000000nn<br />

normal return<br />

nn is error status from ER IOW$.<br />

The FTI is stored in the FCT starting at word 6 (see Figure 5–1). The FTI is initialized if<br />

the file was empty (I/O status 05) or if the first sector was zeroes. If the caller is<br />

going to be adding an element to the file, the next sector location for writing element<br />

text is found at word FCT+7.<br />

On return A1, S6 (bits 30 through 35) has the FTI size indicator. A standard PF (PF or<br />

standard LEPF) will have a value of 0. An LPF (LPF or large LEPF) will have a value<br />

of 4.<br />

On return A1, bit 29 (octal 0100) is the large-element text-allowed bit. For a PF or<br />

LPF, bit 29 is zero (clear). For an LEPF, bit 29 is one (set).<br />

On return when the BSP$ interface level specified on the RFTI$$ function call is 0 or<br />

1, A1, bit 28 (octal 0200) is zero (clear). On return when the BSP$ interface level<br />

specified on the RFTI$$ function call is 2 or more, A1, bit 28 is the program file<br />

initialized bit. If the file was already a program file, bit 28 is zero (clear). If the file was<br />

empty and was initialized as a program file, bit 28 is one (set).<br />

On return A1, bits 0 through 27 are zeroes.<br />

5–8 7833 1733–004


Example of Using RFTI$$<br />

BSP$-Program File Basic Service Package<br />

The following code fragment illustrates an RFTI$$ calling sequence:<br />

L,U A0,FCT . Address of the File Control Table<br />

L A1,(1,56) . BSP$ interface level 1, 56 word FCT<br />

L,U A2,0100++4 . Initialize empty file to allow large<br />

. element text and as a large program<br />

. file (large LEPF)<br />

I$BJ X11,CBRFTI$$ . Call common banked BSP$<br />

J BSPERR . Error on FTI read/initialize<br />

. Proceed on normal return<br />

5.1.2. Read Program File Table<br />

This table must be read into the calling buffer before any operations are performed on<br />

the table. If any add delete, or change operations were completed, then the table must<br />

be written back to the file with one of the WPFxxT$ calls.<br />

The BSP$ entry points for reading program file tables are<br />

(CB)RPFET$ Read Program File Element Table<br />

(CB)RPFAPT$ Read Program File Assembler Procedure Table<br />

(CB)RPFCPT$ Read Program File COBOL Procedure Table<br />

(CB)RPFEPT$ Read Program File FORTRAN/PLUS Procedure Table<br />

(CB)RPFEPT$ Read Program File Relocatable Element Entry Point Table<br />

Calling Sequence<br />

Auto Switch Common Bank or<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

L A1,(buffer, length)<br />

LMJ X11,CBRPFxxT$-1<br />

error return<br />

normal return<br />

L,U A0,address-of-FCT<br />

L A1,(buffer, length)<br />

I$BJ X11,CBRPFxxT$<br />

error return<br />

normal return<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

L,U A1,(buffer, length)<br />

LMJ X11,RPFxxT$<br />

error return<br />

normal return<br />

7833 1733–004 5–9


BSP$-Program File Basic Service Package<br />

Parameters<br />

buffer<br />

length<br />

The starting address of the buffer that is used for the table.<br />

The length in words of the buffer area reserved for the PF table. Only lengths of 196<br />

words (7 sectors), 224 words (8 sectors), and 28* (5+4n) words (5+4n sectors),<br />

where n is a positive integer, are used by BSP$. The specified length will be<br />

rounded down to the next lower buffer length, if necessary. Only this adjusted<br />

buffer length will be read and written by BSP$. A minimum buffer length of 28*<br />

(5+4*2) or 364 is recommended. For maximum efficiency, the buffer length should<br />

be large enough to contain the entire PF table, including the size of table entries to<br />

be added. The starting address of the buffer plus the length must be less than or<br />

equal to 0777777.<br />

Returns<br />

error return<br />

A0 has one of the following values:<br />

012<br />

013<br />

024<br />

025<br />

044<br />

User does not have FTI in main storage.<br />

No starting sector for large program file table.<br />

User buffer too small. The buffer length should be at least 252 words.<br />

User buffer too large. The starting address of the buffer plus the length of the<br />

buffer exceeded 0777777.<br />

No room in file to create this table.<br />

7700000000xx<br />

I/O error, where xx is the I/O status returned.<br />

5–10 7833 1733–004


normal return<br />

BSP$-Program File Basic Service Package<br />

The buffer is filled with the requested table as read from the PF. If the table length<br />

in words in the FTI is 0214 (the size of the pointer table) or less, the requested table<br />

will not be read from the PF but instead the buffer will be initialized. Buffer<br />

initialization means that the requested table will have its pointer table cleared to zero<br />

and its control word set. H1 of the control word will contain the length of the items<br />

comprising the requested table, and H2 will contain zero for the number of table<br />

items.<br />

5.1.3. Search Table for Requested Item<br />

The search table items are<br />

(CB)ETIS$ Element Table Item Search<br />

(CB)APTIS$ Assembler Procedure Table Item Search<br />

(CB)CPTIS$ COBOL Procedure Table Item Search<br />

(CB)FPTIS$ FORTRAN/PLUS Procedure Table Item Search<br />

(CB)EPTIS$ Relocatable Element Entry Point Table Item Search<br />

Calling Sequence<br />

Auto Switch<br />

L,U A0,address-of-FCT<br />

L,U A1,address-of-searchpacket<br />

LMJ X11,CBxxIS$-1<br />

error or no find<br />

normal return<br />

Returns<br />

error return<br />

A0 has one of the following values:<br />

04<br />

Illegal pointer link<br />

Common Bank or<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

L,U A1,address-of-searchpacket<br />

I$BJ X11,CBxxIS$<br />

error or no find<br />

normal return<br />

Registers returned when A0 = 04<br />

A1 = address of search packet<br />

A2 = 0 or previous sequence number containing bad link<br />

A3 = address of table descriptor in FCT<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

L,U A1,address-of-searchpacket<br />

LMJ X11,xxIS$<br />

error or no find<br />

normal return<br />

7833 1733–004 5–11


BSP$-Program File Basic Service Package<br />

012<br />

A4 = 0 or link identifier (1=pointer, 2=type, 3=version)<br />

A5 = sequence number out of range<br />

No FTI<br />

7700000000xx<br />

no find return<br />

I/O error, where xx is the I/O status returned<br />

A0 has one of the following values:<br />

001<br />

011<br />

021<br />

041<br />

A1 = 0<br />

Pointer table<br />

Pointer link<br />

Type link<br />

Version link<br />

A2 = sequence number of last item referenced<br />

normal return<br />

A0 = item location in buffer (that table was previously read into using RPFxxT$).<br />

A1 = sequence number of item<br />

A2<br />

The first half of A2 (H1) is the link type and has one of the following values:<br />

0 Pointer Table<br />

1 Pointer Link<br />

2 Type Link<br />

3 Version Link<br />

5–12 7833 1733–004


BSP$-Program File Basic Service Package<br />

The second half of A2 (H2) contains 0 or the sequence number of the pointing<br />

item.<br />

Packet Formats for Table Item Search<br />

All elements, versions, and procedure names in the following packets are 12 Fieldata<br />

characters, left-justified and space-filled. DF is the delete flag; it is set to 1 if searching<br />

for deleted items.<br />

• Element Table Item Search Packet<br />

0 11 12 17 18 35<br />

0 element name<br />

1<br />

2 zeros<br />

3 D<br />

F<br />

zeros element type zeros<br />

4 version name<br />

5<br />

• Assembler, FORTRAN, or PLUS Procedure Table Item Search Packet<br />

0 35<br />

0 procedure name<br />

1<br />

2 zeros<br />

3 D<br />

F<br />

zeros<br />

7833 1733–004 5–13


BSP$-Program File Basic Service Package<br />

• COBOL Procedure Table Item Search Packet<br />

The first four words are always present in the search packet. The second four<br />

words are present only if the COBOL procedure name exceeds 12 characters and<br />

word 3 bit 1 (CI) is 1.<br />

0 1 2 35<br />

0 COBOL procedure name (first 12 characters)<br />

1<br />

2 zeros<br />

3 D<br />

F<br />

C<br />

I<br />

4 COBOL procedure name (second 12 characters)<br />

5<br />

6 zeros<br />

7 COBOL procedure name (last 6 characters)<br />

• Entry Point Table Item Search Packet<br />

5–14 7833 1733–004<br />

zeros<br />

0 35<br />

0 entry point name<br />

1<br />

2 zeros<br />

3 D<br />

F<br />

zeros<br />

5.1.4. Delete Item from Requested Table<br />

The BSP$ entry points for deleting program file table items are<br />

(CB)ETID$ Element Table Item Delete<br />

(CB)APTID$ Assembler Procedure Table Item Delete<br />

(CB)CPTID$ COBOL Procedure Table Item Delete<br />

(CB)FPTID$ FORTRAN/PLUS Procedure Table Item Delete<br />

(CB)EPTID$ Relocatable Element Entry Point Table Item Delete


Calling Sequence<br />

BSP$-Program File Basic Service Package<br />

Auto Switch Common Bank or Relocatable Relocatable<br />

L,U A0,address-of-FCT<br />

L,U A1,address-of-deletepacket<br />

LMJ X11,CBxxID$-1<br />

error return or no find<br />

return<br />

normal return<br />

Returns<br />

error return<br />

A0 has one of the following values:<br />

04<br />

012<br />

022<br />

Illegal pointer link<br />

L,U A0,address-of-FCT<br />

L,U A1,address-of-deletepacket<br />

I$BJ X11,CBxxID$<br />

error return or no find<br />

return<br />

normal return<br />

Registers returned when A0 = 04:<br />

A1 = address of delete packet<br />

A2 = 0 or previous sequence number containing bad link<br />

A3 = address of table descriptor<br />

A4 = 0 or link identifier (1=pointer, 2=type, 3=version)<br />

A5 = sequence number out of range<br />

FTI not in main storage<br />

Designated table not in main storage<br />

7700000000xx<br />

I/O error, where xx is the I/O status returned<br />

L,U A0,address-of-FCT<br />

L,U A1,address-of-deletepacket<br />

LMJ X11,xxID$<br />

error return or no find<br />

return<br />

normal return<br />

It may be necessary to write the requested table back to mass storage (WPFxxT$)<br />

and write the FTI (WFTI$) to appropriately update the file for changes that were<br />

successfully made before the error occurred. Otherwise the file is left in a partially<br />

corrupted state.<br />

7833 1733–004 5–15


BSP$-Program File Basic Service Package<br />

no find return<br />

A0 has one of the following values:<br />

001<br />

011<br />

021<br />

041<br />

Pointer table<br />

Pointer<br />

A1 = 0<br />

Type Link<br />

Version link<br />

A2 = sequence number of last item referenced<br />

normal return<br />

Requested item has been deleted from table.<br />

A0 = pointer to item marked as deleted<br />

A1 = sequence number of item marked as deleted<br />

A2 = link type (H1) and sequence number of item pointing to this item (H2)<br />

Packet Formats for Table Item Delete<br />

• Element Table Item<br />

0 11 12 17 18 35<br />

0 element name<br />

1<br />

2 zeros<br />

3 zeros zeros type zeros<br />

4 version name or blank<br />

5<br />

Note: Element type 1 may be used for deleting procedures of types 2, 3, or 4.<br />

5–16 7833 1733–004


BSP$-Program File Basic Service Package<br />

• Assembler, FORTRAN, or PLUS Procedure Table Item Delete Packet<br />

0 35<br />

0 procedure name<br />

1<br />

3 zeros<br />

4 zeros<br />

• COBOL Procedure Table Item Delete Packet<br />

0 1 35<br />

0 COBOL procedure name (first 12 characters)<br />

1<br />

2 zeros<br />

3 0 C<br />

I<br />

4 COBOL procedure name (second 12 characters)<br />

5<br />

6 zeros<br />

7 COBOL procedure name (last six characters)<br />

Note: The first 4 words are included in every CPT Delete Packet. The second 4 words<br />

are included only if the procedure name exceeds 12 characters, and bit 1 of word 3<br />

(Continuation Indicator) is set.<br />

• Entry Point Table Item Delete Packet<br />

0 35<br />

0 entry point name<br />

1<br />

2 zeros<br />

3 zeros<br />

7833 1733–004 5–17


BSP$-Program File Basic Service Package<br />

5.1.5. Entry Look-Up by Number<br />

The BSP$ entry points for looking up program file items by sequence number are<br />

(CB)ETNL$ Element Table Number Look-up<br />

(CB)APTNL$ Assembler Procedure Table Number Look-up<br />

(CB)CPTNL$ COBOL Procedure Table Number Look-up<br />

(CB)FPTNL$ FORTRAN Procedure Table Number Look-up<br />

(CB)EPTNL$ Relocatable Element Entry Point Table Number Look-up<br />

Calling Sequence<br />

Auto Switch<br />

L,U A0,address-of-FCT<br />

L,U A1,sequence-number<br />

LMJ X11,CBxxNL$-1<br />

error return<br />

normal return<br />

Returns<br />

error return<br />

A0 has one of the following values:<br />

04<br />

012<br />

014<br />

022<br />

Sequence number not in table<br />

FTI not in main storage<br />

Common Bank or<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

L,U A1,sequence-number<br />

I$BJ X11,CBxxNL$<br />

error return<br />

normal return<br />

Sequence number is out of range<br />

Table not in main storage<br />

7700000000xx<br />

I/O error, where xx is the I/O status returned<br />

Relocatable<br />

L,,U A0,address-of-FCT<br />

L,U A1,sequence-number<br />

LMJ X11,xxNL$<br />

error return<br />

normal return<br />

5–18 7833 1733–004


A1 = sequence number<br />

A2 = number of entries in table<br />

normal return<br />

BSP$-Program File Basic Service Package<br />

A0 = Location of item in buffer (that table was previously read into using RPFxxT$).<br />

For the CPTNL$ entry point, this is the location of the 4-word block indicated by the<br />

sequence number supplied by the caller.<br />

The COBOL procedure table item may be 4 words or 8 words in length. However,<br />

BSP$ returns the pointer to a 4-word block in register A0. Therefore, the<br />

continuation indicator (bit 1, offset 3 of the item) may be checked to determine the<br />

size of the item. A suggested method of searching the COBOL procedure table is<br />

shown in the following example.<br />

7833 1733–004 5–19


BSP$-Program File Basic Service Package<br />

Example of Using CPTNL$<br />

The following example uses CPTNL$ to search the COBOL procedure table:<br />

$INCLUDE 'MAXR$' .<br />

$(0) .<br />

FCT $RES 34 . File control table<br />

CPTBL $RES 252 . Buffer for COBOL procedure table<br />

FILENAME ‘FILE ‘ . Program file name<br />

CPTNUM $EQUF,H2 0213,X1 . Number of 4 word blocks<br />

$(1) .<br />

START .<br />

DL A6,FILENAME . Get file name<br />

DS A6,FCT . Put it in first two words of FCT<br />

L,U A0,FCT . Get address of FCT<br />

LMJ X11,RFTI$ . Read FTI<br />

J BSPERR . Error return<br />

.<br />

L,U A0,FCT . Get address of FCT<br />

L A1,(CPTBL,252) . Get address, length of buffer<br />

LMJ X11,RPFCPT$ . Read COBOL procedure table<br />

J BSPERR . Error return<br />

.<br />

L,U X1,CPTBL . Get address of buffer for CPTNUM<br />

LA,U A7,0 . Initialize loop counter to zero<br />

LOOP .<br />

L,U A0,FCT . Get address of FCT<br />

AA,U A7,1 . Increment loop counter<br />

L A1,A7 . Set sequence number<br />

LMJ X11,CPTNL$ . Get COBOL item for sequence number<br />

J BSPERR . Error return<br />

.<br />

L,S1 A3,3,A0 . Get continuation indicator bit<br />

TOP,U A3,020 . Is it set?<br />

J 4WORDITEM . No, handle 4 word item<br />

AA,U A7,1 . 8 word item, increment loop counter<br />

. to skip reading next 4-word block<br />

. .<br />

. . handle 8-word item<br />

. .<br />

J CHKLOOP . Check for loop termination<br />

4WORDITEM .<br />

. .<br />

. . handle 4-word item<br />

. .<br />

CHKLOOP . Loop termination code<br />

TE A7,CPTNUM . Last 4-word block reached?<br />

J LOOP . No, keep reading<br />

. .<br />

. .<br />

. .<br />

5–20 7833 1733–004


5.1.6. Change Item in Requested Table<br />

BSP$-Program File Basic Service Package<br />

The entry points to change an item in one of the program file tables are the following<br />

[CB]ETIC$ Change Element Table Item<br />

[CB]APTIC$ Change Assembler Procedure Table Item<br />

[CB]CPTIC$ Change COBOL Procedure Table Item<br />

[CB]FPTIC$ Change FORTRAN/PLUS Procedure Table Item<br />

[CB]EPTIC$ Change Relocatable Element Entry Point Table Item<br />

Calling Sequence<br />

Auto Switch<br />

L,U A0,address-of-FCT<br />

L,U A1,address-of-searchpacket<br />

L,U A2,address-of-new-item<br />

LMJ X11,CBxxIC$-1<br />

error or no find return<br />

normal return<br />

Common Bank or<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

L,U A1,address-of-searchpacket<br />

L,U A2,address-of-new-item<br />

I$BJ X11,CBxxIC$<br />

error or no find return<br />

normal return<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

L,U A1,address-of-searchpacket<br />

L,U A2,address-of-new-item<br />

LMJ X11,xxIC$<br />

error or no find return<br />

normal return<br />

The formats for the Table Item Search Packet are described in 5.1.3, “Search Table for<br />

Requested Item.” The name in this packet is the name of the item to be changed. If an<br />

Element Table Item is to be changed then the element type and version name (if any)<br />

must also be specified. The address of the Table Item Search Packet must be in register<br />

A1.<br />

The formats for the new Table Item are described in 5.1.7, “Add Item to Requested<br />

Table.” The address of the new Table Item must be in register A2.<br />

The new Table Item (address in register A2) will replace the Table Item specified by the<br />

search packet (address in register A1).<br />

Returns<br />

error return (0,X11)<br />

A0 has one of the following values:<br />

004<br />

012<br />

Illegal pointer link<br />

No FTI<br />

7833 1733–004 5–21


BSP$-Program File Basic Service Package<br />

022<br />

045<br />

Designated table not in main storage buffer<br />

New item is different size than search item<br />

07700000000xx<br />

I/O error, xx is I/O status code<br />

It may be necessary to write the requested table back to mass storage (WPFxxT$)<br />

and write the FTI (WFTI$) to appropriately update the file for changes that were<br />

successfully made before the error occurred. Otherwise the file is left in a partially<br />

corrupted state.<br />

no-find return (0,X11)<br />

A0 has one of the following values:<br />

001<br />

011<br />

021<br />

041<br />

Pointer table<br />

Pointer link<br />

Type link<br />

Version link<br />

normal return (1,X11)<br />

A0<br />

A1<br />

A2<br />

Location of changed item in buffer that table was previously read into using<br />

Read Program File Table (RFPxxT$) function<br />

Sequence number of changed item<br />

Sequence number of duplicate item that was deleted (if any)<br />

5–22 7833 1733–004


5.1.7. Add Item to Requested Table<br />

BSP$-Program File Basic Service Package<br />

The BSP$ entry points for adding items to program file tables are<br />

(CB)ETIA$ Element Table Item Add<br />

(CB)APTIA$ Assembler Procedure Table Item Add<br />

(CB)CPTIA$ COBOL Procedure Table Item Add<br />

(CB)FPTIA$ FORTRAN/PLUS Procedure Table Item Add<br />

(CB)EPTIA$ Relocatable Entry Point Table Item Add<br />

Calling Sequence<br />

Auto Switch<br />

L,U A0,address-of-FCT<br />

L,U A1,address-of-addpacket<br />

LMJ X11,CBxxIC$-1<br />

error or no find return<br />

normal return<br />

Returns<br />

error return<br />

A0 has one of the following values:<br />

04<br />

Illegal pointer link<br />

Registers returned when A0 = 04:<br />

012<br />

022<br />

Common Bank or<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

L,U A1,address-of-addpacket<br />

I$BJ X11,CBxxIC$<br />

error return<br />

normal return<br />

A1 = address of packet (search, add, or delete)<br />

A2 = 0 or previous sequence number containing bad link<br />

A3 = address of table descriptor<br />

A4 = 0 or link identifier (1=pointer, 2=type, 3=version)<br />

A5 = sequence number out of range<br />

FTI not in main storage<br />

Designated table not in main storage<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

L,U A1,address-of-addpacket<br />

LMJ X11,xxIC$<br />

error return<br />

normal return<br />

7833 1733–004 5–23


BSP$-Program File Basic Service Package<br />

044<br />

046<br />

047<br />

No room for item<br />

Illegal element type of 1 (subtype 035 only), 2, 3, 4, 5, or 6 for LEPF<br />

Illegal element text length granularity value for LEPF<br />

7700000000xx<br />

I/O error, where xx is the I/O status retured<br />

It may be necessary to write the requested table back to mass storage (WPFxxT$)<br />

and write the FTI (WFTI$) to appropriately update the file for changes that were<br />

successfully made before the error occurred. Otherwise the file is left in a partially<br />

corrupted state.<br />

normal return<br />

Requested item has been added to designated table.<br />

A0 = address in buffer of item added<br />

A1 = new sequence number<br />

A2 = sequence number of duplicate element or 0<br />

If the item being added duplicates an existing item, the existing item is automatically<br />

marked as deleted by BSP$.<br />

If the item being added is for the Element Table (ETIA$ function), the following items<br />

should be noted:<br />

• If the first word of the version name in the packet (word 4) is zeroes, blanks will be<br />

used for the entire version name (words 4 and 5).<br />

• If time and date in the packet (word 9) are zeroes, the current time and date will be<br />

used.<br />

• If this program file is a PF or LPF (RFTI$ or RFTI$$ normal return with A1, bit 29<br />

clear; see 5.1.1), the element may have at most 262,143 sectors of element text.<br />

• If this program file is an LEPF (RFTI$$ normal return with A1, bit 29 set) the element<br />

may have over 262,143 sectors of element text. Additional LEPF considerations are<br />

contained in this section under the packet descriptions for symbolic and omnibus<br />

elements and in 5.3.<br />

• If this program file is an LEPF, procedure elements (element type 1, subtype 035 and<br />

element types 2, 3, and 4), relocatable elements (element type 5), and executable<br />

elements (element type 6) may not be added to the PF.<br />

5–24 7833 1733–004


BSP$-Program File Basic Service Package<br />

• The calling program is responsible for updating the FTI next write location in word<br />

FCT+7 (see Figure 5–1).<br />

• If the element being added is a relocatable element, the Relocatable Element Entry<br />

Point Table control information in the FTI is cleared. This removes the table when<br />

the FTI is written back to the program file.<br />

Packet Formats for Table Item Add<br />

• Symbolic or Procedure Element Add to Element Table<br />

0 5 6 11 12 17 18 23 24 29 30 35<br />

0 element name (Fieldata L.J.S.F.)<br />

1<br />

2 zero<br />

3 flag-bits element-type zero<br />

4 version name or blanks (Fieldata L.J.S.F.)<br />

5<br />

6 cycle limit latest cycle number current number of cycles<br />

7 element<br />

subtype<br />

length of element text<br />

8 sector location of element text on mass storage<br />

9 time element added (or zero) date element added (or zero)<br />

Flag-bits (word 3, bits 0 through 11) include the 2-bit element-text-length granularity<br />

field in bits 1 and 2. The meaning of this field depends on one of the following two<br />

program file types:<br />

• For a PF or LPF, this field is not used and should be zero.<br />

• For an LEPF, this field contains the granularity of the length of element-text field<br />

in word 7.<br />

The following may be specified for element-text-length granularity:<br />

0 Element text length is in number of sectors<br />

1 Element text length is in number of tracks. A track contains<br />

64 sectors.<br />

2 Element text length is in number of positions. A position<br />

contains 64 tracks or 4,096 sectors.<br />

7833 1733–004 5–25


BSP$-Program File Basic Service Package<br />

Element type is<br />

01 If Symbolic Element<br />

02 If Assembler Procedure Element<br />

03 If COBOL Procedure Element<br />

04 If FORTRAN Procedure Element.<br />

A procedure element cannot be added to an LEPF.<br />

Element subtype: see 2.4, SSTYP$.<br />

Length of element text (word 7, bits 6 through 35). The meaning of this field<br />

depends on one of the following two program file types:<br />

• For a PF or LPF, bits 6 through 17 of this field are not used and should be zero.<br />

Bits 18 through 35 are the length of the element text in sectors. This allows a<br />

maximum of 0777777 or 262,143 sectors of element text.<br />

• For an LEPF, the meaning of this field depends on the contents of the flag-bits<br />

element-text-length granularity field, as previously described.<br />

• Relocatable Element Add to Element Table<br />

0 11 12 17 18 35<br />

0 element name (Fieldata L.J.S.F.)<br />

1<br />

2 zero<br />

3 flag-bits type = 5 zero<br />

4 version name or blanks (Fieldata L.J.S.F.)<br />

5<br />

6 location of preamble<br />

7 length of preamble length of relocatable text<br />

8 sector location of element text on mass storage<br />

9 time element added (or zero) date element added (or zero)<br />

5–26 7833 1733–004


BSP$-Program File Basic Service Package<br />

The total length in sectors of the element text is the sum for length of preamble and<br />

length of relocatable text.<br />

A relocatable element cannot be added to an LEPF.<br />

• Executable Element Add to Element Table<br />

0 11 12 17 18 35<br />

0 element name (Fieldata L.J.S.F.)<br />

1<br />

2 zero<br />

3 flag-bits type = 6 zero<br />

4 version name or blanks<br />

5<br />

6 bank informataion<br />

7 zero length of element text<br />

8 sector location of element on mass storage<br />

9 time element added (or zero) date element added (or zero)<br />

An executable element cannot be added to an LEPF.<br />

• Omnibus Element Add to Element Table<br />

0 5 6 11 12 17 18 23 24 29 30 35<br />

0 element name (Fieldata L.J.S.F.)<br />

1<br />

2 zero<br />

3 flag-bits type = 7 zero<br />

4 version name or blanks (Fieldata L.J.S.F.)<br />

5<br />

6 Reserved for use by applications<br />

7 element<br />

subtype<br />

element<br />

subsubtype<br />

length of element text<br />

8 sector location of element text on mass storage<br />

9 time element added (or zero) date element added (or zero)<br />

7833 1733–004 5–27


BSP$-Program File Basic Service Package<br />

Flag-bits (word 3, bits 0 through 11) include the 2-bit element-text-length granularity<br />

field in bits 1 and 2. This field is described following the Symbolic or Procedure<br />

Element Add to Element Table packet.<br />

Element subtype (word 7, bits 0 through 5) is described in section 2.4, SSTYP$.<br />

Length of element text (word 7, bits 12 through 35). The meaning of this field<br />

depends on one of the following two program file types:<br />

• For a PF or LPF, bits 12 through 17 of this field are not used and should be zero.<br />

Bits 18 through 35 are the length of the element text in sectors. This allows a<br />

maximum of 0777777 or 262,143 sectors of element text.<br />

• For an LEPF, the meaning of this field depends on the contents of the flag-bits<br />

element-text-length-granularity field, as described following the Symbolic or<br />

Procedure Element Add to Element Table packet.<br />

• Assembler, FORTRAN, or PLUS Procedure Item<br />

0 1 2 3 4 5 6 17 18 35<br />

0 procedure name<br />

1<br />

2 related element table item number zero<br />

3 D<br />

F<br />

0 A S K 0 relative word location of the procedure in the file<br />

• COBOL Procedure Item Add to COBOL Procedure Table<br />

0 1 2 3 4 5 6 17 18 35<br />

0 COBOL procedure name (first 12 characters)<br />

1<br />

2 related element table item number zero<br />

3 D<br />

F<br />

C<br />

I<br />

A S K 0 relative word location of the procedure in the file<br />

4 COBOL procedure name (second 12 characters)<br />

5<br />

6 zeros<br />

7 COBOL procedure name (final six characters)<br />

Note: The first 4 words must be in all COBOL Procedure Table Add Packets.<br />

The second 4 words will be present only if the COBOL procedure name exceeds<br />

12 characters, and bit 1 of word 3 (continuation indicator) is set to 1.<br />

5–28 7833 1733–004


• Entry Point Table Item Add<br />

BSP$-Program File Basic Service Package<br />

0 17 18 35<br />

0 entry point name<br />

1<br />

2 related element table item number zero<br />

3 D<br />

F<br />

5.1.8. Write Last Item <strong>Reference</strong>d<br />

7833 1733–004 5–29<br />

zeros<br />

The BSP$ entry points for writing out the last item referenced are<br />

(CB)PTEWT$ Part Table Element Table Write<br />

(CB)PTATWT$ Part Table Assembler Procedure Table Write<br />

(CB)PTCTWT$ Part Table COBOL Procedure Table Write<br />

(CB)PTFTWT$ Part Table FORTRAN Procedure Table Write<br />

(CB)PTETWT$ Part Table Entry Point Table Write<br />

Calling Sequence<br />

Auto Switch<br />

L,U A0,address-of-FCT<br />

LMJ X11,CBPTxxWT$-1<br />

Returns<br />

error return<br />

error return<br />

normal return<br />

A0 has one of the following values:<br />

7700000000xx<br />

012<br />

Common Bank or<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

I$BJ X11,CBPTxxWT$<br />

error return<br />

normal return<br />

I/O error, where xx is the I/O status returned<br />

No FTI<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

LMJ X11,PTxxWT$<br />

error return<br />

normal return


BSP$-Program File Basic Service Package<br />

022<br />

024<br />

Table not in main storage. Caller must have first done an RPFxxT$ call.<br />

User error<br />

normal return<br />

Last item referenced written.<br />

This function should be called only if the previous BSP$ functions: search table (xxIS$),<br />

delete item (xxIS$), entry look-up (xxNL$), change item (xxIC$), or add item (xxIA$)<br />

resulted in a normal return. In each case, register A0 has the address of the table item<br />

processed by the function. The PTxxWT$ function will write the 1 or 2 sectors (28 or 56<br />

words) that contain the table item to mass storage. Note the following about this<br />

function:<br />

• It is not necessary to call this function after the delete item, change item, or add<br />

item functions. The modified item will be written to mass storage either before<br />

BSP$ reads the next buffer or when the WPFxx$ function is called.<br />

• This function should be called only if it is determined that the table item must be<br />

written to mass storage immediately.<br />

• This function is very inefficient, particularly if many table items need to be written,<br />

for the following reasons:<br />

− Writing small buffers of 1 or 2 sectors incurs a large amount of overhead.<br />

− Because each table item is only a partial sector, each sector may need to be<br />

written multiple times. For the element table, each sector is written an average<br />

of 3.6 times. For the other program file tables, each sector is written an average<br />

of 7 times.<br />

• The mark item as updated (xxIS$) function (see 5.1.9) should be considered as a<br />

more efficient alternative to this function.<br />

5.1.9. Mark Item as Updated<br />

The BSP$ entry points for marking the last program file table item referenced as having<br />

been updated are:<br />

(CB)ETIU$ Element Table Item Updated<br />

(CB)APTIU$ Assembler Procedure Table Item Updated<br />

(CB)CPTIU$ COBOL Procedure Table Item Updated<br />

(CB)FPTIU$ FORTRAN/PLUS Procedure Table Item Updated<br />

(CB)EPTIU$ Relocatable Element Entry Point Item Updated<br />

5–30 7833 1733–004


Calling Sequence<br />

Auto Switch<br />

L,U A0,address-of-FCT<br />

LMJ X11,CBxxIU$-1<br />

Returns<br />

error return<br />

error return<br />

normal return<br />

A0 has one of the following values:<br />

012<br />

022<br />

normal return<br />

FTI not in main storage.<br />

BSP$-Program File Basic Service Package<br />

Common Bank or<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

I$BJ X11,CBxxIU$<br />

Designated table not in main storage.<br />

error return<br />

normal return<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

LMJ X11,xxIU$<br />

error return<br />

normal return<br />

The last program file table item referenced is marked as having been updated. The<br />

table item will be written to mass storage, either before BSP$ reads the next buffer<br />

or when the WPFxx$ function is called.<br />

This function should be called only if the previous BSP$ search table (xxIS$) or look-up<br />

(xxNL$) function resulted in a normal return and if the caller subsequently modified the<br />

table item pointed to by register A0. The following should be noted about this function:<br />

• It is not necessary to call this function after the delete item (xxID$), change item<br />

(xxIC$) or add item (xxIA$) functions. The table item is already marked as updated<br />

by these functions.<br />

• This function is efficient, since it does not perform any I/O.<br />

• The write last item referenced (PTxxWT$) function described in 5.1.8 should be used<br />

if it determined that the table item must be written to mass storage immediately.<br />

7833 1733–004 5–31


BSP$-Program File Basic Service Package<br />

5.1.10. Write Requested Table Back to Mass Storage<br />

The BSP$ entry points for writing program file tables back to the file are<br />

(CB)WPFET$ Write Program File Element Table<br />

(CB)WPFAPT$ Write Program File Assembler Procedure Table<br />

(CB)WPFCPT$ Write Program File COBOL Procedure Table<br />

(CB)WPFFPT$ Write Program File FORTRAN Procedure Table<br />

(CB)WPFEPT$ Write Program File Entry Point Table<br />

Calling Sequence<br />

Auto Switch<br />

L,U A0,address-of-FCT<br />

LMJ X11,CBWPFxx$-1<br />

error return<br />

normal return<br />

Returns<br />

error return<br />

A0 has one of the following values:<br />

012<br />

022<br />

FTI not in main storage<br />

Common Bank or<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

I$BJ X11,CBWPFxx$<br />

error return<br />

normal return<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

LMJ X11,WPFxx$<br />

error return<br />

normal return<br />

Requested table not in main storage. Caller must have first done an RPFxxT$<br />

call.<br />

7700000000xx<br />

normal return<br />

I/O error, where xx is the I/O status returned.<br />

Designated Table, Pointer Table, and last segment left in main storage, if changed,<br />

are written to mass storage.<br />

5–32 7833 1733–004


5.1.11. Write FTI<br />

Write the FTI back to the program file.<br />

Calling Sequence<br />

Auto Switch<br />

L,U A0,address-of-FCT<br />

LMJ X11,CBWFTI$-1<br />

error return<br />

normal return<br />

Returns<br />

error return<br />

A0 has one of the following values:<br />

042<br />

043<br />

BSP$-Program File Basic Service Package<br />

Common Bank or<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

I$BJ X11,CBWFTI$<br />

error return<br />

normal return<br />

Relocatable<br />

L,U A0,address-of-FCT<br />

LMJ X11,WFTI$<br />

error return<br />

normal return<br />

At least one table has not been written back by a call on Write Program File<br />

Table.<br />

Invalid next sector for text<br />

7700000000xx<br />

normal return<br />

I/O Error, where xx is the I/O status code returned.<br />

The FTI has been written back to mass storage.<br />

7833 1733–004 5–33


BSP$-Program File Basic Service Package<br />

5.2. Example of Using BSP$<br />

The following example uses BSP$ to access a program file:<br />

$(2)<br />

FCT $RES 43 . File control table<br />

ELTTBL $RES 252 . Buffer for element table<br />

FILENAME ‘TESTFILE ‘ . Program file name<br />

ADDPKT . BSP$ add packet<br />

‘NEWPROGRAM ‘ . Element name<br />

+ 0 . Word 2 of add packet<br />

+ 1,0 . Element type (symbolic)<br />

‘VERS-3 ‘ . Element version name<br />

+ 5,0,1 . Element cycle information<br />

+ ELTLEN . Sector length of element text<br />

+ ELTADRR . Address of element text (sector)<br />

+ 0 . Time and date element added<br />

. (filled by BSP$)<br />

.<br />

.<br />

.<br />

$(1)<br />

DL A6,FILENAME . Get file name<br />

DS A6,FCT . Put in top of FCT<br />

L,U A0,FCT . Get address of FCT<br />

LMJ X11,RFTI$ . Read FTI<br />

J BSPERR . Error return<br />

.<br />

L,U A0,FCT . Get address of FCT<br />

L A1,(ELTTBL,252) . Get addr,len of buffer<br />

LMJ X11,RPFET$ . Read element table into buffer<br />

J BSPERR . Error return<br />

.<br />

L,U A0,FCT . Get address of FCT<br />

L,U A1,ADDPKT . Get address of add packet<br />

LMJ X11,ETIA$ . Add the element to the file<br />

J BSPERR . Error return<br />

.<br />

. Write element text, using SDFO (for example)<br />

.<br />

L,U A0,FCT . Get address of FCT<br />

LMJ X11,WPFET$ . Write back the element table<br />

J BSPERR . Error return<br />

L A7,FCT+7 . Get next write location<br />

A,U A7,ELTLEN . Add length of new element<br />

S A7,FCT+7 . Put in FCT<br />

.<br />

L,U A0,FCT . Get address of FCT<br />

LMJ X11,WFTI$ . Write back the<br />

J BSPERR . Error return<br />

.<br />

.<br />

.<br />

5–34 7833 1733–004


BSP$-Program File Basic Service Package<br />

In this example, BSP$ adds an element to a program file. The following two buffers and<br />

one packet are required:<br />

• FCT is for the file control table<br />

• ELTTBL is for the program file element table<br />

• ADDPKT is for a packet that holds information about the element to be added<br />

The first call to BSP$ reads the file control table. The file control table must be read<br />

before any other calls are made to BSP$.<br />

The next call to BSP$ is to read the program file element table. This table must be read<br />

before elements are added, deleted or searched for.<br />

The BSP$ call to ETIA$ adds the element described in the add packet ADDPKT to the<br />

contents in the file TESTFILE. The element name is NEWPROGRAM with version name<br />

VERS-3. It is a symbolic element, cycle 0, with a maximum cycle limit of 5.<br />

ELTLEN is the sector length of the element. ELTADDR is the starting sector address of<br />

the element in the file TESTFILE. The calling program must write the actual text of the<br />

element to the file using the SDFO routine.<br />

When the element is added to the program file element table, the table must be written<br />

back to WPFET$. The next write location is updated by adding the element sector<br />

length to word 7 of the FCT. A call to WFTI$ writes the updated FTI back to the file.<br />

This completes updating of the file.<br />

5.3. LEPF Considerations<br />

This section contains additional information, limitations, restrictions, and considerations<br />

pertaining to LEPFs and their use.<br />

The following are general limitations and restrictions:<br />

• LEPFs are first supported by the BSP$ contained in <strong>SYSLIB</strong> level 76R1. LEPFs are<br />

not recognized as program files by any prior <strong>SYSLIB</strong> level.<br />

• The initial implementation of LEPFs is intended primarily for use by MAPPER, as a<br />

container for large MAPPER reports (symbolic elements) that have over 262,143<br />

sectors of element text.<br />

• Initially, only MAPPER, FURPUR, PCFP, and BSP$ support LEPFs.<br />

• Initially, LEPFs are not supported by the Exec, including the ER PFx$ interface and<br />

the command line interface (@ADD, @START, @XQT, and so on).<br />

• Initially, LEPFs cannot contain procedure elements (element type 1, subtype 035,<br />

and element types 2, 3, and 4), relocatable elements (element type 5), and<br />

executable elements (element type 6).<br />

• Calling programs that are not modified will not recognize LEPFs as program files.<br />

This includes programs that call the relocatable version of BSP$, even when they are<br />

re-collected with <strong>SYSLIB</strong> level 76R1 or higher.<br />

7833 1733–004 5–35


BSP$-Program File Basic Service Package<br />

The following are considerations when reading or initializing the program file FTI with the<br />

RFTI$ or RFTI$$ functions (see 5.1.1):<br />

• Calling programs that use the RFTI$ function will not recognize existing LEPFs and<br />

cannot initialize an empty file as an LEPF. These programs must be modified to use<br />

the RFTI$$ function to read the FTI.<br />

• Calling programs that use the RFTI$$ function must be modified to specify the new<br />

parameter, BSP$ interface level, in register A1, H1. A value of 1 is required to<br />

recognize existing LEPFs and to initialize an empty file as an LEPF.<br />

• The parameter specified in register A2 is ignored if the file is an existing program file.<br />

• On a normal return, the value in register A1 describes the basic program file<br />

characteristics of the file that was read or initialized. Bit 29 of A1 is clear if this file is<br />

a PF or LPF; bit 29 of A1 is set if this file is an LEPF. The calling program should<br />

save the A1 return value so that the contents of existing element table entries can<br />

be correctly interpreted and so that new element table entries can be correctly<br />

formatted.<br />

To correctly interpret the length of element text when reading element table entries with<br />

the ETIS$ function (see 5.1.3) or the ETNL$ function (see 5.1.5), the following need to be<br />

considered:<br />

• When reading elements from a PF or LPF:<br />

− The maximum element text size is 262,143 sectors.<br />

− The element text length in word 7 is stated in sectors for all element types.<br />

− For all element types, the flag bits field, element-text-length granularity (word 3,<br />

bits 1 and 2) is not used and should be ignored.<br />

− For symbolic elements, element-text-length word 7, bits 6 through 17 (S2 and<br />

S3) are not used and should be ignored.<br />

− For omnibus elements, element-text-length word 7, bits 12 through 17 (S3) are<br />

not used and should be ignored.<br />

• When reading elements from an LEPF:<br />

− The maximum element text size is limited only by maximum file size. The<br />

theoretical maximum is 07777764400 or 1,073,735,936 sectors. This is based<br />

on the maximum possible file size minus 1,792 sectors reserved for the TOC of<br />

a standard LEPF.<br />

− Make sure the correct field size is used when loading element-text length from<br />

word 7. For symbolic elements the field size is 30 bits (bits 6 through 35) and<br />

for omnibus elements the field size is 24 bits (bits 12 through 35).<br />

− Once the correct element-text-length value is loaded, the element-text-length<br />

granularity field (word 3, bits 1 and 2) must be examined:<br />

ο If it is 0, element text length is stated in sectors.<br />

ο If it is 1, element text length is stated in tracks. Track granularity can be<br />

converted to sector granularity by multiplying by 64 or by shifting left by 6<br />

bits.<br />

5–36 7833 1733–004


BSP$-Program File Basic Service Package<br />

ο If it is 2, element text length is stated in positions. Position granularity can<br />

be converted to sector granularity by multiplying by 4,096 or by shifting left<br />

by 12 bits.<br />

ο Combinations of element text length and element text length granularity can<br />

result in a number of sectors that are over the theoretical maximum<br />

described above. The result may even be over 36 bits, so maximum value<br />

checks or double-word operations are recommended to determine the<br />

validity of the calculated element text length.<br />

The following are considerations when creating element table entries with the ETIA$<br />

function (see 5.1.7):<br />

• When creating elements in a PF or LPF:<br />

− The maximum element text size is 262,143 sectors.<br />

− The element-text-length granularity (word 3, bits 1 and 2) field should be 0.<br />

− For symbolic elements, element-text-length word 7, bits 6 through 17 (S2 and<br />

S3) should be 0.<br />

− For omnibus elements, element-text-length word 7, bits 12 through 17 (S3)<br />

should be 0.<br />

• When creating elements in an LEPF:<br />

− If the element text is at most 262,143 sectors, use the previous PF and LPF<br />

format for the element table item.<br />

− For efficiency and to avoid wasted mass storage, select the smallest granularity<br />

possible. Sector granularity is the smallest, followed by track and then position.<br />

ο For symbolic elements, the 30-bit element-text-length field is large enough<br />

to describe any element text using sector granularity. Neither track nor<br />

position granularity is needed for symbolic elements.<br />

ο For omnibus elements, the 24-bit element-text-length field is large enough to<br />

describe element text of 16,777,152 sectors using sector granularity. For<br />

element text larger that this, use track granularity. Position granularity is not<br />

needed for omnibus elements.<br />

− When using track or position granularity, make sure that element text length is<br />

rounded up to the next granule, if necessary. For example, 5,000 tracks plus 1<br />

sector (320,001 sectors) must be rounded up to 5,001 tracks (320,064 sectors);<br />

70 positions plus 1 sector (286,721 sectors) must be rounded up to 71 positions<br />

(290,816 sectors).<br />

− If element text length is rounded up, as described above, additional sectors must<br />

be written to pad the element to the proper granule boundary. It is<br />

recommended that sectors containing zeroes be used for the padding. In the<br />

previous examples, the track granularity element would require 63 sectors of<br />

padding and the position granularity element would require 4,095 sectors of<br />

padding.<br />

− When using track or position granularity, make sure that the final element text<br />

length is converted back to number of sectors when updating the FTI next write<br />

location in word FCT+7 (see Figure 5–1).<br />

7833 1733–004 5–37


BSP$-Program File Basic Service Package<br />

5–38 7833 1733–004


Section 6<br />

CABSAD$, CRELAD$–Addressing<br />

Routines<br />

The CABSAD$ routine computes the absolute address for a given address relative to a<br />

location counter. CRELAD$ computes the element name, location counter number, and<br />

address relative to the location number of a caller-specified absolute address.<br />

The following routines are available either as relocatables or common bank absolutes and<br />

can be used in conjunction with D-bank segments above 65K addressing.<br />

When calling the common bank version of the routines, it is necessary to provide a<br />

300-word buffer for their internal use.<br />

6.1. Absolute Addressing Routines<br />

The CABSAD$ routines are called by the MASM procedure C$ABSAD. C$ABSAD is<br />

used to generate the calling sequence for the relocatable version, the common bank<br />

version, or the common bank version using the Auto Switch calling sequence. Section 3<br />

describes the advantages and disadvantages of using the different types of calls.<br />

Calling Format<br />

C$ABSAD[,t] func-code [,p1,p2,p3] [pkt-addr]<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

Type of call to the routine. This parameter is optional and may be omitted. CB or A,<br />

if specified, must be enclosed by apostrophes.<br />

blank Call the relocatable version. This is the default if t is omitted.<br />

'CB' Call the common bank version.<br />

'A' Call the common bank version using the Auto Switch method.<br />

7833 1733–004 6–1


CABSAD$, CRELAD$–Addressing Routines<br />

func-code<br />

The function code determines which of the absolute addressing routines is called by<br />

C$ABSAD. The function codes are described in the sections explaining each of the<br />

functions. The function code must be enclosed by apostrophes.<br />

The only values allowed for the function code on the C$ABSAD procedure call are<br />

CABSAD$, CAINIT$, CBX$, CSX$, and CSYMVL$. Any other value entered for the<br />

function code parameter on the C$ABSAD procedure call causes MASM to generate<br />

an E flag on that line and print the error message.<br />

p1,p2,p3<br />

ILLEGAL C$ABSAD FUNCTION<br />

The use of these parameters depends on the particular routine being called by<br />

C$ABSAD. Some of the routines use only p1; some may use only p1 and p2. In<br />

general, these parameters may be omitted. If so, the calling procedure uses the<br />

values in specific registers for the values of these parameters. Each routine's<br />

subsection describes these parameters.<br />

pkt-addr<br />

Address of the 300-word packet required by the common bank version of the<br />

routines. If this parameter is omitted and the common bank version of the routine is<br />

called (parameter t set to 'A' or 'CB'), then the address in register A5 is used as the<br />

starting address of the packet. This parameter may be omitted if the call is to the<br />

relocatable version of the routines but including it does not cause any problems.<br />

6.1.1. CABSAD$–Compute Absolute Address<br />

CABSAD$ computes the absolute address for a given address relative to a location<br />

counter.<br />

Calling Format<br />

C$ABSAD[,t] ‘CABSAD$’[,rel-addr,lc,elt-name] [pkt-addr]<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

See 6.1.<br />

CABSAD$<br />

CABSAD$ is the function code that determines which of the absolute addressing<br />

routines is called by C$ABSAD. It must be enclosed by apostrophes.<br />

6–2 7833 1733–004


el-addr<br />

lc<br />

CABSAD$, CRELAD$–Addressing Routines<br />

Relative address to be converted. This is the address relative to some location<br />

counter that is converted to an absolute address.<br />

Location counter of the address to be converted. Parameter rel-addr gives the<br />

address to be converted relative to a specific location counter. This parameter tells<br />

the routine which location counter to use. This parameter may be given as an actual<br />

number, a tag that has been equated to an actual number, or the address of a word<br />

that contains the number.<br />

elt-name<br />

Name of the element containing the relocatable address that is to be converted to an<br />

absolute address. The element name may be from 1 to 12 characters selected from<br />

the set A through Z, 0 through 9, and the special characters - and $. If given as a<br />

string, then the parameter must be surrounded by apostrophes on the procedure<br />

call. This parameter can also be given as the address of a two-word area that<br />

contains the name in Fieldata format, left-justified and space-filled.<br />

pkt-addr<br />

See 6.1.<br />

If all of the parameters rel-addr,lc,elt-name are omitted on the call, then the routine uses<br />

the value in register A0 for rel-addr, the value in register A1 for lc, and the value in<br />

registers A2 and A3 for elt-name.<br />

Returns<br />

normal<br />

Register A0 contains the requested absolute address and A1 contains a pointer to<br />

the Segment Load Table (SLT$). If register A1 = 0, either the program is not<br />

segmented or the element lies in the main segment. The absolute address returned<br />

in A0 is always in main storage.<br />

The following instruction causes the instruction immediately after it to be skipped if<br />

the element is in main storage:<br />

TP SLT$,A1<br />

On return, H1 of register A2 contains the length of the specified location counter and<br />

H2 of register A2 contains the starting address of that location counter, for possible<br />

further use.<br />

7833 1733–004 6–3


CABSAD$, CRELAD$–Addressing Routines<br />

error<br />

A0 < 0<br />

A0 > 0<br />

The requested address does not exist. Possible reasons include:<br />

• The executing program does not have this element<br />

• The element has no such location counter<br />

• The location is out of range for that location counter<br />

• The program was collected with the Z option, so there are no diagnostic<br />

tables. See the Collector <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong><br />

• The element is not an absolute element<br />

A0 has an I/O error status code, and register A1 contains the sector address of<br />

the error on mass storage in the file from which the program is loaded.<br />

Reinitializing CABSAD$<br />

If a program using CABSAD$ is checkpointed and restarted, the restart contingency<br />

routine should contain the following instruction to reinitialize the CABSAD$ tables:<br />

SZ *CABSAD$-1<br />

6.1.2. CAINIT$–Initialize CABSAD$<br />

CAINIT$ initializes CABSAD$ to examine the diagnostic tables of an absolute element<br />

other than the one being executed.<br />

CAINIT$ initializes the tables in CABSAD$. The tables point to the diagnostic tables of<br />

an absolute element that is indicated by the file name and header table start address.<br />

Until reinitialized, all references to CABSAD$, CSX$, CBX$, and CSYMVL$ refer to the<br />

specified absolute element. <strong>Reference</strong>s to the Segment Load Table (SLT$) are not valid<br />

unless CABSAD$ is working on the absolute element that is executing.<br />

Calling Format<br />

C$ABSAD[,t] ‘CAINIT$’[,file-name,sector-addr] [pkt-addr]<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

See 6.1.<br />

6–4 7833 1733–004


CAINIT$<br />

CABSAD$, CRELAD$–Addressing Routines<br />

CAINIT$ is the function code that determines which of the absolute addressing<br />

routines is called by C$ABSAD. It must be enclosed by apostrophes.<br />

file-name<br />

Internal name of the file containing the absolute element that the calling program<br />

wishes to examine. The file name may be from 1 to 12 characters selected from the<br />

set A through Z, 0 through 9, and the special characters - and $. If given as a string,<br />

then the parameter must be surrounded by apostrophes on the procedure call. This<br />

parameter may also be given as the address of a two-word area that contains the<br />

name in Fieldata format, left-justified and space-filled.<br />

sector-addr<br />

Sector location of the absolute element in the file named by parameter file-name.<br />

This parameter may be given as an actual number, a tag that has been equated to an<br />

actual number or the address of a word that contains value that is to be used as the<br />

sector address.<br />

pkt-addr<br />

See 6.1.<br />

If both of the parameters file-name and sector-addr are omitted on the call, then the<br />

routine uses the value in the register pair A0 and A1 for file-name and the value in<br />

register A2 for sector-addr.<br />

Error Return<br />

The error return is identical to a CABSAD$ error return.<br />

6.1.3. CBX$–Compute Bank Descriptor Index<br />

CBX$ computes the bank descriptor index (BDI) that corresponds to a given bank name.<br />

Calling Format<br />

C$ABSAD[,t] ‘CBX$’[,bank-name] [pkt-addr]<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

See 6.1.<br />

7833 1733–004 6–5


CABSAD$, CRELAD$–Addressing Routines<br />

CBX$<br />

CBX$ is the function code that determines which of the absolute addressing routines<br />

are called by C$ABSAD. It must be enclosed by apostrophes.<br />

bank-name<br />

Name of the bank for which the routine should find the BDI. The bank name may be<br />

from 1 to 12 characters selected from the set A through Z, 0 through 9, and the<br />

special characters - and $. If given as a string, then the parameter must be<br />

surrounded by apostrophes on the procedure call. This parameter may also be given<br />

as the address of a two-word area that contains the name in Fieldata format, leftjustified<br />

and space-filled.<br />

If the parameter bank-name is omitted, then the routine uses the value in registers<br />

A0 and A1 for bank-name. In this case the bank name must be left justified in the<br />

register pair and space filled. The name must be in Fieldata format.<br />

pkt-addr<br />

See 6.1.<br />

Returns<br />

error<br />

normal<br />

A0 = 0<br />

A0 > 0<br />

The system could not find the specified name in the diagnostic table.<br />

An I/O error occurred. The register contents are the same as for an I/O error<br />

from CABSAD$.<br />

Register A0 contains the requested BDI.<br />

6.1.4. CSX$–Compute Segment Index<br />

CSX$ computes the segment index that corresponds to a given segment name.<br />

The calling program can convert a segment index to a Segment Load Table (SLT$) offset<br />

pointer by multiplying the index by 4. Segment indexes are the values that reference ER<br />

LOAD$. The main segment is an exception.<br />

Calling Format<br />

C$ABSAD[,t] ‘CSX$’[,seg-name] [pkt-addr]<br />

error return<br />

normal return<br />

6–6 7833 1733–004


Parameters<br />

t<br />

CSX$<br />

See 6.1.<br />

CABSAD$, CRELAD$–Addressing Routines<br />

CSX$ is the function code that determines which of the absolute addressing routines<br />

are called by C$ABSAD. It must be enclosed by apostrophes.<br />

seg-name<br />

Name of the segment for which the routine should find the segment index. The<br />

segment name may be from 1 to 12 characters selected from the set A through Z, 0<br />

through 9, and the special characters - and $. If given as a string, then the parameter<br />

must be surrounded by apostrophes on the procedure call. This parameter may also<br />

be given as the address of a two-word area that contains the name in Fieldata<br />

format, left-justified and space-filled.<br />

pkt-addr<br />

See 6.1.<br />

If the parameter seg-name is omitted, then the routine uses the value in registers A0 and<br />

A1 for seg-name. In this case, the bank name must be left-justified in the register pair<br />

and space-filled. The name must be in Fieldata format.<br />

Returns<br />

error<br />

normal<br />

The error conditions are the same as for CBX$.<br />

Register A0 contains the requested segment index.<br />

6.1.5. CSYMVL$–Compute Symbol Value<br />

CSYMVL$ computes the value of an externally defined global symbol.<br />

Calling Format<br />

C$ABSAD[,t] ‘CSYMVL$’[,symbol] [pkt-addr]<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

See 6.1.<br />

7833 1733–004 6–7


CABSAD$, CRELAD$–Addressing Routines<br />

CSYMVL$<br />

CSYMVL$ is the function code that determines which of the absolute addressing<br />

routines are called by C$ABSAD. It must be enclosed by apostrophes.<br />

symbol<br />

Name of the symbol for which the routine computes a value. The symbol name may<br />

be from 1 to 12 characters selected from the set A through Z, 0 through 9, and the<br />

special character $. If given as a string, then the parameter must be surrounded by<br />

apostrophes on the procedure call. This parameter may also be given as the address<br />

of a two-word area that contains the name in Fieldata format, left-justified and spacefilled.<br />

If the parameter symbol is omitted, then the routine uses the value in registers A0<br />

and A1 for symbol. In this case, the name must be left-justified in the register pair<br />

and space-filled. The name must be in Fieldata format.<br />

pkt-addr<br />

See 6.1.<br />

Returns<br />

error<br />

normal<br />

Error conditions are the same as those for CBX$.<br />

Register A0 contains the value of the symbol, and register A1 contains a Segment<br />

Load Table (SLT$) pointer (as discussed for CABSAD$). If the symbol is absolute,<br />

register A1 is always zero. If the collection source uses the TYPE EXTDIAG<br />

statement, any externally defined symbol of the collection may be looked up.<br />

Otherwise, unreferenced symbols and symbols defined in SYS$*RLIB$ elements are<br />

excluded. If the symbol is not global, in other words, if it is defined instead by a<br />

locally included element, one of the local definitions is returned. The definition that<br />

is returned cannot be predicted.<br />

6.2. Relocatable Addressing Routines<br />

The CRELAD$ routines are called by the MASM procedure C$RELAD. C$RELAD is used<br />

to generate the calling sequence for the relocatable version, the common bank version,<br />

or the common bank version using the Auto Switch calling sequence. Section 3<br />

describes the advantages and disadvantages of using the different types of calls.<br />

Calling Format<br />

C$RELAD[,t] func-code [,p1,p2] [pkt-addr]<br />

error return<br />

normal return<br />

6–8 7833 1733–004


Parameters<br />

t<br />

CABSAD$, CRELAD$–Addressing Routines<br />

Type of call to the routine. This parameter is optional and may be omitted. CB or A,<br />

if specified, must be enclosed by apostrophes.<br />

func-code<br />

p1,p2<br />

blank Call the relocatable version. This is the default if t is omitted.<br />

'CB' Call the common bank version.<br />

'A' Call the common bank version using the Auto Switch method.<br />

The function code determines which of the absolute addressing routines are called<br />

by C$RELAD. The function codes are described in the sections explaining each of<br />

the functions. The function code must be enclosed by apostrophes.<br />

The only values allowed for the function code on the C$RELAD procedure call are<br />

CRELAD$, CRINIT$, CBN$, and CSN$. Any other value entered for the function<br />

code parameter on the C$RELAD procedure call causes MASM to generate an E flag<br />

on that line and print the error message<br />

ILLEGAL C$RELAD FUNCTION<br />

The description of these parameters depends on the particular routine being called<br />

by C$RELAD. Some of the routines only use p1; some may use both p1 and p2. In<br />

general, these parameters may be omitted. If so, the calling procedure uses the<br />

values in specific registers for the values of these parameters. Each routine's<br />

subsection describes these parameters.<br />

pkt-addr<br />

Address of the 300-word packet required by the common bank version of the<br />

routines. If this parameter is omitted and the common bank version of the routine is<br />

called (parameter t set to 'A' or 'CB'), then the address in register A5 is used as the<br />

starting address of the packet. This parameter may be omitted if the call is to the<br />

relocatable version of the routines, but including it does not cause any problems.<br />

6.2.1. CRELAD$–Compute Relative Address<br />

CRELAD$ computes the element name, location counter number, and address relative<br />

to the location number of a caller-specified absolute address.<br />

Calling Format<br />

C$RELAD[,t] ‘CRELAD$’[,abs-addr] [pkt-addr]<br />

error return<br />

normal return<br />

7833 1733–004 6–9


CABSAD$, CRELAD$–Addressing Routines<br />

Parameters<br />

t<br />

See 6.1.<br />

CRELAD$<br />

CRELAD$ is the function code that determines which of the absolute addressing<br />

routines is called by C$RELAD. It must be enclosed by apostrophes.<br />

abs-addr<br />

Absolute address that is to be converted to a relative address.<br />

If this parameter is omitted, then the routine uses the value in register A0 for<br />

abs-addr.<br />

pkt-addr<br />

See 6.1<br />

Normal Return<br />

If CRELAD$ returns normally, registers A2 and A3 contain an element name that is<br />

left-justified and space-filled. The relative address values corresponding to the input<br />

absolute address are in two registers: register A1 contains a location counter number,<br />

and register A0 contains an address relative to that location counter.<br />

If the input value in register A0 is not in the range of the program, then register A0 is<br />

unchanged, register A1 is set to zero, the register pair A2, A3 is filled with the Fieldata<br />

characters "*ABSOLUTE*", and the normal return is taken. This case also occurs if the<br />

collection of the absolute is done with the Z option on the call to the Collector. When<br />

the Z option is used on the Collector call, the diagnostic tables are not included in the<br />

absolute element produced, and relative addresses cannot be computed.<br />

On normal return, registers A4 and A5 contain the location counter limits or zeros if the<br />

address was absolute. Register A4 equals the location counter lower limit - 1, and A5<br />

equals the location counter upper limit. The following instruction skips the instruction<br />

immediately after it if x contains an address in the same element and location counter<br />

range as the address on the call to CRELAD$ that computed A4 and A5.<br />

TW A4,x<br />

The calling program can save the computation by calling CRELAD$ using registers A1,<br />

A2, and A3 and computing A0 = x-(A4+1).<br />

The routine must be part of the main segment. Only one activity can use CRELAD$ at<br />

one time.<br />

If more than one element in different segments has addresses corresponding to the<br />

given absolute address, the one in main storage is used. If there is no element in main<br />

storage, an error condition exists.<br />

6–10 7833 1733–004


CABSAD$, CRELAD$–Addressing Routines<br />

Error Return<br />

The error return is taken if an I/O status other than 0 or 5 is encountered. In that case,<br />

register A0 contains the status code, register A1 contains the error address on mass<br />

storage, A2 through A3 contain the Fieldata characters "INPUT ERROR", and A4 through<br />

A5 contain zero.<br />

Reinitializing CRELAD$<br />

If a program using CRELAD$ is checkpointed and restarted, CRELAD$ must be<br />

reinitialized. Use the following instruction in the restart contingency code when calling<br />

the relocatable version.<br />

SZ *CRELAD$-1<br />

When calling the common bank version, store zero into the first word of the 300-word<br />

buffer.<br />

SZ buffer-name<br />

The alternate relocatable calling sequence is<br />

L A0,(bdi,addr)<br />

LMJ X11,CRELAD$<br />

error return<br />

normal return<br />

The alternate common bank calling sequence is<br />

L A0,(bdi,addr)<br />

L,U A5,300-word-buffer-starting-address<br />

I$BJ X11,CB$CRELAD$<br />

error return<br />

normal return<br />

This entry and the previous example provide the same results. The only difference is<br />

that a bank descriptor index is specified in H1 of A0. This is necessary if the address in<br />

H2 of register A0 is in an unbased bank or a bank that overlaps the bank containing<br />

CRELAD$ (usually the control bank) and the address is in the overlap area. Otherwise,<br />

when CRELAD$ performs an ER BANK$ to determine the bank descriptor index for the<br />

address, it obtains the wrong BDI because the CRELAD$ bank descriptor register is then<br />

active.<br />

7833 1733–004 6–11


CABSAD$, CRELAD$–Addressing Routines<br />

6.2.2. CRINIT$–Initialize CRELAD$<br />

CRINIT$ initializes CRELAD$ to examine the diagnostic tables of an absolute element<br />

other than the one the system is executing.<br />

This routine initializes the tables of CRELAD$ so that they point to the diagnostic tables<br />

of the absolute element specified by the calling program. All references to CRELAD$,<br />

CSN$, and CBN$ refer to the specified absolute element until they are reinitialized.<br />

<strong>Reference</strong>s to loaded segments are not meaningful unless CRELAD$ is working on the<br />

absolute element that the system is executing.<br />

Calling Format<br />

C$RELAD[,t] ‘CRINIT$’[,file-name,sector-addr] [pkt-addr]<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

See 6.1<br />

CRINIT$<br />

CRINIT$ is the function code that determines which of the absolute addressing<br />

routines is called by C$RELAD. It must be enclosed by apostrophes.<br />

file-name<br />

Internal name of the file containing the absolute element that the calling program<br />

wishes to examine. The file name may be from 1 to 12 characters selected from the<br />

set A through Z, 0 through 9, and the special characters - and $. If given as a string,<br />

then the parameter must be surrounded by apostrophes on the procedure call. This<br />

parameter may also be given as the address of a two-word area that contains the<br />

name in Fieldata format, left-justified and space-filled.<br />

sector-addr<br />

The sector location of the absolute element in the file named by parameter p1. This<br />

parameter may be given as an actual number, a tag that has been equated to an<br />

actual number or the address of a word that contains a value that is to be used as<br />

the sector address.<br />

6–12 7833 1733–004


pkt-addr<br />

See 6.1<br />

CABSAD$, CRELAD$–Addressing Routines<br />

If both of the parameters file-name and sector-addr are omitted on the call, then the<br />

routine uses the value in registers A0 and A1 for file-name and the value in register A2<br />

for sector-addr.<br />

Error Return<br />

The error return is identical to a CRELAD$ error return.<br />

6.2.3. CBN$–Convert BDI to Symbolic Bank Name<br />

CBN$ determines the symbolic bank name that corresponds to the given BDI and<br />

returns it in registers A0 and A1 in Fieldata format, left-justified, and space-filled.<br />

Calling Format<br />

C$RELAD[,t] ‘CBN$’[,bdi] [pkt-addr]<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

CBN$<br />

bdi<br />

See 6.1.<br />

CBN$ is the function code that determines which of the absolute addressing<br />

routines is called by C$RELAD. It must be enclosed by apostrophes.<br />

bank descriptor index that is to be translated into a bank name. This parameter may<br />

be included as a number, as a tag that has been equated to a number, or as the<br />

address of a word that contains the value of the number.<br />

If parameter bdi is omitted, then the value in register A0 is used as the BDI.<br />

pkt-addr<br />

See 6.1.<br />

Error Return<br />

If A0 = 0 at the error return, the BDI is out of range or refers to a common bank. If A0 ≠<br />

0, an I/O error occurred and the registers contain the same values as for a CRELAD$ I/O<br />

error.<br />

7833 1733–004 6–13


CABSAD$, CRELAD$–Addressing Routines<br />

6.2.4. CSN$–Convert Segment Index to Segment Name<br />

CSN$ determines the symbolic segment name that corresponds to the given segment<br />

index and returns it in registers A0 and A1 in Fieldata format, left-justified, and spacefilled.<br />

Calling Format<br />

C$RELAD[,t] ‘CSN$’[,seg-index] [pkt-addr]<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

CSN$<br />

See 6.1.<br />

CSN$ is the function code that determines which of the absolute addressing<br />

routines is called by C$RELAD. It must be enclosed by apostrophes.<br />

seg-index<br />

Segment index of the segment is to be translated into a segment name. This<br />

parameter may be included as a number, as a tag that has been equated to a<br />

number, or as the address of a word that contains the value of the number.<br />

If the parameter seg-index is omitted, then the value in register A0 is used as the<br />

segment index.<br />

pkt-addr<br />

See 6.1.<br />

Returns<br />

The error and normal returns are the same as for CBN$.<br />

6–14 7833 1733–004


Section 7<br />

CONWRD$–Condition Word Routine<br />

The CONWRD$ routine manipulates bits 7 and 8 of the condition word (bit 0 is the<br />

leftmost bit of the word). These bits indicate whether a task completed successfully or<br />

unsuccessfully, and are defined as follows:<br />

Bit 7 If set, one or more previous tasks had an error.<br />

Bit 8 If set, the most recent task had an error.<br />

See the Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for details on the condition word. The<br />

EXEC extensions to ER SETC$ and @SETC that use bits 7 and 8 of the condition word<br />

are in level 38R2 and higher levels.<br />

CONWRD$ can be called from both MASM or PLUS routines. CONWRD$ is available as<br />

a relocatable element in the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or SYS$*RLIB$ and also in<br />

the <strong>SYSLIB</strong> common bank <strong>SYSLIB</strong>$1. The relocatable and common bank entry points to<br />

CONWRD$ are listed in Appendix E.<br />

7.1. MASM Interface<br />

CONWRD$ is called with the MASM PROC C$ONWRD. This PROC can call CONWRD$<br />

as a relocatable element, a common bank element, or a common bank element using<br />

the Auto Switch method.<br />

CONWRD$ does not return any parameters or status codes to the caller.<br />

Calling format<br />

C$ONWRD[,t] func<br />

normal return<br />

7833 1733–004 7–1


CONWRD$–Condition Word Routine<br />

Parameters<br />

t<br />

func<br />

The type of call to CONWRD$. This parameter is optional and may be omitted. If CB<br />

or A is specified, it must be enclosed by apostrophes.<br />

blank<br />

'CB'<br />

'A'<br />

Call the relocatable version of CONWRD$. This is the default if t is omitted.<br />

Call the common bank version of CONWRD$.<br />

Call the common banked version of CONWRD$ using the Auto Switch method.<br />

The function for CONWRD$ to perform; it must be enclosed by apostrophes.<br />

'SET27$'<br />

Set bit 8 of the condition word; if bit 8 was already set, then set bit 7.<br />

'CLEAR27$'<br />

Clear bit 8 of the condition word; bit 7 is not changed.<br />

Note: The names SET27 and CLEAR27 may appear to be unusual names for these<br />

functions. The reason for this is that they were named when a different numbering<br />

convention for bit positions was being used. Bit position 27 in the old convention<br />

corresponds to bit position 8 in the current convention.<br />

Example<br />

The following example calls CONWRD$ from a MASM routine.<br />

1. $(1)<br />

2. START<br />

.<br />

.<br />

.<br />

3. C$ONWRD ‘SET27$’ . Set bit 8 of the condition word<br />

.<br />

.<br />

4. C$ONWRD,’CB’ ‘CLEAR27$’ . Clear bit 8<br />

In this example, line 3 calls the relocatable version of CONWRD$ to set bit 8 of the<br />

condition word. Line 4 calls the common bank version of CONWRD$ to clear bit 8 of the<br />

condition word.<br />

7–2 7833 1733–004


7.2. PLUS Interface<br />

CONWRD$–Condition Word Routine<br />

CONWRD$ is called from PLUS routines by declaring procedures with the appropriate<br />

entry points.<br />

Calling Sequence<br />

The following entry points are defined for CONWRD$:<br />

CWSET$<br />

Call the relocatable version of CONWRD$ and set bit 8 of the condition word; if bit 8<br />

is already set, then set bit 7 (bit 0 is the leftmost bit of the word).<br />

CWCLEAR$<br />

Call the relocatable version of CONWRD$ and clear bit 8 of the condition word; bit 7<br />

is not changed.<br />

CBCWSET$<br />

Call the common bank version of CONWRD$ and set bit 8 of the condition word; if<br />

bit 8 is already set, then set bit 7.<br />

CBCWCLEAR$<br />

Call the common bank version of CONWRD$ and clear bit 8 of the condition word;<br />

bit 7 is not changed.<br />

Example<br />

The following example calls CONWRD$ from a PLUS routine:<br />

1. PROCEDURE SET_TASK_ERROR IMPORTED (‘CWSET$’);<br />

2. PROCEDURE CLEAR_TASK_ERROR IMPORTED (‘CBCWCLEAR$’);<br />

.<br />

.<br />

.<br />

3. SET_TASK_ERROR; " Set bit 8 of Condition Word<br />

.<br />

.<br />

4. CLEAR_TASK_ERROR; " Clear bit 8<br />

In this example, line 1 declares a procedure to call the relocatable version of CONWRD$<br />

and set bit 8 of the condition word. Line 2 declares a procedure to call the common<br />

bank version of CONWRD$ and clear bit 8 of the condition word. Lines 3 and 4 execute<br />

the calls to CONWRD$ to manipulate the condition word.<br />

7833 1733–004 7–3


CONWRD$–Condition Word Routine<br />

7–4 7833 1733–004


Section 8<br />

EDIT$–Fieldata Image Composition<br />

Editing Package<br />

EDIT$ is a unified collection of routines that may be used to compose strings of Fieldata<br />

characters in an area that you specify. EDIT$ may produce<br />

• Images for the printer and the punch<br />

• Symbiont control images<br />

• Control statements for CSF$<br />

EDIT$ has routines for editing decimal, octal, and floating point (single and double<br />

precision) as well as routines for copying character strings and adjusting column settings.<br />

Routines are also available for editing the time and the date. A versatile collection of<br />

Assembler procedures makes it easy to code for EDIT$.<br />

EDIT$ is reentrant and uses no D-bank storage. Working storage is provided by a 6-word<br />

packet (10 words if floating point is used) provided by the user. The format of this<br />

packet is given in 8.1.<br />

The EDIT$ editing package consists of four elements.<br />

• EDIT$–general-purpose editing routines<br />

• EDIT$T–time and date editing routines<br />

• EDIT$F–floating-point editing routines<br />

• EDIT$P–procedure calls for editing routines<br />

EDIT$ does not reference the other routines. However, both EDIT$T and EDIT$F require<br />

the services of EDIT$.<br />

7833 1733–004 8–1


EDIT$–Fieldata Image Composition Editing Package<br />

8.1. EDIT$–Packet Format<br />

The EDIT$ packet format is as shown in Figure 8–1 (italicized fields are filled by the<br />

caller).<br />

0 ts msg il iloc<br />

1 CIX WIX CIM WIM<br />

2 fps fpr zero RETURN<br />

3 RET SAVE1<br />

4 SAVE2<br />

5 SAVE3<br />

6 dpc spc NDP NDF SIGN ZERO<br />

7 FCOL SCALE<br />

8 VALUE<br />

9<br />

Fields Set by the Caller<br />

ts<br />

msg<br />

il<br />

iloc<br />

fps<br />

fpr<br />

Figure 8–1. EDIT$: Packet Format<br />

This area may be used as a test-and-set flag by the user.<br />

Signal character for EMSG$ and EMSGR$.<br />

Image length in words.<br />

Image location (18-bit address).<br />

Number of digits to be placed to the left of the decimal point for scientific-format,<br />

floating-point editing.<br />

If nonzero, the floating-point rounding option is on; five is added to the first<br />

significant digit after the last significant digit to be printed.<br />

For example, if the input is 1.4356 and 3 digits are to be printed, the result is 1.44.<br />

8–2 7833 1733–004


zero<br />

dpc<br />

spc<br />

Must be zero.<br />

EDIT$–Fieldata Image Composition Editing Package<br />

If nonzero, specifies the character that will separate the mantissa and the exponent<br />

for scientific-format, double-precision, floating-point editing. Normally D if nonzero.<br />

If nonzero, specifies the character that will separate the mantissa and the exponent<br />

for scientific format, single-precision, floating-point editing. Normally E if nonzero.<br />

Fields Maintained by EDIT$<br />

These fields are used only for debugging.<br />

CIX<br />

WIX<br />

CIM<br />

WIM<br />

Used by EDITX$ to save the character index for EDITR$.<br />

Used by EDITX$ to save the relative word index for EDITR$.<br />

Used by EMSG$ and EMSGR$ to save the character index to the input message.<br />

Used by EMSG$ and EMSGR$ to save the word index to the input message.<br />

RETURN<br />

RET<br />

SAVE1<br />

SAVE2<br />

Used as the return point for the character store vector.<br />

Used to save the return point to the user during calls to other EDIT$ functions.<br />

Used to save the modifier portion of X1 during edit mode.<br />

Used to save X2 during edit mode.<br />

7833 1733–004 8–3


EDIT$–Fieldata Image Composition Editing Package<br />

SAVE3<br />

NDP<br />

NDF<br />

SIGN<br />

ZERO<br />

FCOL<br />

SCALE<br />

VALUE<br />

Used to save X3 during edit mode.<br />

Number of digits to be edited before the decimal point.<br />

Number of digits to be edited following the decimal point.<br />

Nonzero if the floating-point number being edited is negative.<br />

Nonzero if the floating-point number being edited was not normalized.<br />

Contains information to facilitate proper positioning of the edited result.<br />

Used to build the exponent.<br />

Used to save intermediate results (two words). (Used only by floating point.)<br />

Packet Generation<br />

Two procedures are available to generate a packet for EDIT$. The E$PKT procedure<br />

generates a 6-word packet, and the E$PKTF procedure generates a 10-word packet<br />

suitable for floating-point editing. The format of the procedure calls is<br />

E$PKT il,iloc [‘MSG’,EMSG$-stop]<br />

E$PKTF il,iloc [‘MSG’,EMSG$-stop]<br />

[‘FPS’,fps-number] [‘FPR’,fpr-number]<br />

[‘DPC’,dpc-char] [‘SPC’,spc-char]<br />

The optional lists override the assumed values to be placed in the fields msg, fps, fpr,<br />

dpc, spc. The assumed values are msg = '&', fps = 1, fpr = 1, dpc = 0, and spc = 0.<br />

The format of an override list consists of the name of the field enclosed in quotes, a<br />

comma, and the value to be used. For example, the following PROC reference<br />

generates a packet that edits floating-point numbers in a format similar to that used by<br />

FORTRAN:<br />

PKT E$PKTF 22,LINE ‘FPS’,0 ‘FPR’,0 ‘SPC’,’E’ ‘DPC’,‘D’<br />

8–4 7833 1733–004


EDIT$–Fieldata Image Composition Editing Package<br />

8.2. EDIT$–General-Purpose Editing Routines<br />

PROC Call<br />

Before using the EDIT$ package, the caller must first establish edit mode by calling the<br />

EDIT$ routine. When edit mode is on, the index registers X1, X2, and X3 are used as<br />

pointers by EDIT$; do not disturb them. The original values of these registers are<br />

restored when edit mode is turned off. The only other registers used by EDIT$ are X11,<br />

A0, A1, A2, A3, and R1. These registers are not saved or restored. Table 8–1 describes<br />

the routines used to initialize and terminate EDIT$.<br />

All EDIT$ routines are called with an LMJ on X11 and expect the parameters in A0, A1,<br />

and A2. A column pointer is maintained by EDIT$; the pointer is advanced by the<br />

number of characters inserted whenever an editing function is performed. The first<br />

column is zero.<br />

Table 8–2 describes the EDIT$ routines.<br />

Each routine in the EDIT$ editing package has a corresponding procedure call. If there<br />

are no parameters, then load instructions are not generated and the input data is<br />

assumed to be in the designated registers. The parameters may be in the format<br />

"*u,*x,j".<br />

When two parameters are required (p1, p2), the first instruction is not generated if p2 is<br />

missing. If both p1 and p2 are missing, neither load instruction is generated. Some of<br />

the procedures do not require any parameters.<br />

Table 8–1. Initialization and Termination<br />

Generated<br />

Instructions<br />

E$DIT p1 LA,U A0,p1<br />

LMJ X11,EDIT$<br />

E$DITR p1 LA,U A0,p1<br />

LMJ X11,EDITR$<br />

Description<br />

Initializes and establishes edit mode.<br />

If p1 is not specified, the address of the packet must be in A0. S3<br />

of the first word of the packet is expected to contain the number<br />

of words in the image area, and H2 of the first word of the packet<br />

is expected to contain the location of the image area. The image is<br />

set to blanks and edit mode is established. The column pointer is<br />

set to the start of the image.<br />

Reenters edit mode.<br />

E$DITX LMJ X11,EDITX$ Terminates edit mode.<br />

E$PRINT p1 LA,U A0,p1<br />

LMJ X11,EPRINT$<br />

If p1 is not specified, the address packet must be in A0. Edit<br />

mode is reestablished and the column pointer (saved by EDITX$) is<br />

restored.<br />

The column pointer is saved in the packet. EDITX$ returns with<br />

the packet address in A0 and the number of words in the image in<br />

A1.<br />

Prints image line and EDITX$.<br />

See EPRINT$ description in Table 8–2.<br />

7833 1733–004 8–5


EDIT$–Fieldata Image Composition Editing Package<br />

PROC Call Generated<br />

Instructions<br />

E$CHAR p1 LA,U A0,p1<br />

Table 8–2. General-Purpose Editing Routines<br />

LMJ X11,ECHAR$<br />

Inserts a character.<br />

E$CLEAR LMJ X11,ECLEAR$ Clears image.<br />

Description<br />

The character contained in S6 of A0 is inserted into the image.<br />

The image is set to blanks and the column pointer is set to the<br />

start of the image (column zero).<br />

E$COLN LMJ X11,ECOLN$ Computes the column number.<br />

E$COL p1 LA,U A0,p1<br />

LMJ X11,ECOL$<br />

E$COPY p1, p2 LA,U A0,p2<br />

LA,U A1,p1<br />

LMJ X11,ECOPY$<br />

E$DCFZ p1, p2 LA A0,p2<br />

LA,U A1,p1<br />

LMJ X11,EDCFZ$<br />

E$DECF p1, p2 LA A0,p2<br />

LA,U A1,p1<br />

LMJ X11,EDECF$<br />

E$DECV p1 LA A0,p1<br />

LMJ X11,EDECV$<br />

E$FD1 p1 LA A0,p1<br />

LMJ X11,EFD1$<br />

E$FD2 p1 DL A0,p1<br />

LMJ X11,EFD2$<br />

Returns with the column number in A0.<br />

Positions to a fixed column.<br />

The column pointer is changed to the number specified in A0.<br />

The first character position of the image is column 0.<br />

Copies a string.<br />

A0 is expected to contain the address of a string of characters.<br />

A0 increment may contain a character offset for the first word<br />

in the range 0–5. Number of characters in A1 is copied from<br />

this area into the image.<br />

Edits decimal (fixed length with leading zero).<br />

Edits A0 to a decimal number right-justified in a field of A1<br />

characters. A leading "-" is added if A0 is negative. The result<br />

overflows the field to the right if it does not fit into the specified<br />

field size. Leading zeros are produced where EDECF$ would<br />

produce leading spaces. This routine is convenient for editing<br />

decimal fractions.<br />

Edits decimal (fixed length).<br />

Edits A0 to a decimal number right-justified in a field of A1<br />

characters. A leading "-" is added if A0 is negative. The result<br />

overflows the field to the right if it does not fit into the specified<br />

field size.<br />

Edits decimal (variable length).<br />

Edits A0 to a decimal number. A leading "-" is added if A0 is<br />

negative. The number of characters generated is a function of<br />

the sign and magnitude of A0.<br />

Inserts Fieldata (one word).<br />

The six characters in A0 are inserted into the image. Blanks and<br />

master spaces are ignored.<br />

Inserts Fieldata (two words).<br />

The 12 characters in A0 and A1 are inserted into the image.<br />

Blanks and master spaces are ignored.<br />

8–6 7833 1733–004


PROC Call Generated<br />

Instructions<br />

EDIT$–Fieldata Image Composition Editing Package<br />

Table 8–2. General-Purpose Editing Routines<br />

E$MSGR LMJ X11,EMSGR$ Message editor reentry.<br />

E$MSG p1 LA,U A0,p1<br />

LMJ X11,EMSG$<br />

E$OCTF p1, p2 LA A0,p2<br />

LA,U A1,p1<br />

LMJ X11,EOCTF$<br />

E$OCTV p1 LA A0,p1<br />

LMJ X11,EOCTV$<br />

E$PACK p1, p2 LA,U A0,p2<br />

LA,U A1,p1<br />

LMJ X11,EPACK$<br />

E$PRINT p1 LA,U A0,p1<br />

LMJ X11,EPRINT$<br />

E$SKIP p1 LA,U A0,p1<br />

LMJ X11,ESKIP$<br />

Description<br />

This routine performs the same operation as EMSG$ except<br />

that the pointer to the input string is taken from the packet.<br />

With these two routines, it is possible to copy a string into the<br />

image, occasionally interrupting this process to perform other<br />

editing functions at certain selected points in the string.<br />

Message editor initial entry.<br />

Copies the characters starting at the address given in A0 into<br />

the image. This process stops when the character in S2 of the<br />

first word of the packet is found. The pointer to this string is<br />

saved in the packet and return is made to the user.<br />

Edit octal (fixed length).<br />

Edits A0 to A1 octal digits. Leading zeros are not suppressed.<br />

A1 must not exceed 12.<br />

Edit octal (variable length).<br />

Edits contents of A0 to octal. The number of digits edited<br />

depends on the size of the number. If the number is greater<br />

than seven, a leading zero is added.<br />

Copies and packs a string.<br />

Same as ECOPY$ except that master spaces are ignored.<br />

Prints image line and EDITX$.<br />

The image pointed to by the image location in the packet is<br />

printed and EDITX$ performed. The line spacing is given in A0.<br />

If the parameter is omitted, a value of one is used.<br />

Advances the column pointer.<br />

The number given in A0 is added to the column pointer. A0<br />

may be negative.<br />

7833 1733–004 8–7


EDIT$–Fieldata Image Composition Editing Package<br />

8.3. EDIT$T–Time and Date Editing Routines<br />

Table 8–3 describes the time and date editing routines.<br />

Each of these routines accepts input in ER TDATE$ format (see the Exec ER<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>).<br />

Month day year (relative to<br />

1964)<br />

Table 8–3. Time and Date Editing Routines<br />

PROC Call Generated Instructions Description<br />

E$DAY1 p1 LA A0,p1<br />

LMJ X11,EDAY1$<br />

E$DAT1 ER TDATE$<br />

LMJ X11,EDAY1$<br />

E$DAY2 p1 LA A0,p1<br />

LMJ X11,EDAY2$<br />

E$DAT2 ER TDATE$<br />

LMJ X11,EDAY2$<br />

E$DAY3 p1 LA A0,p1<br />

LMJ X11,EDAY3$<br />

E$DAT3 ER TDATE$<br />

LMJ X11,EDAY3$<br />

E$DAY4 p1 LA A0,p1<br />

LMJ X11,EDAY4$<br />

E$DAT4 ER TDATE$<br />

LMJ X11,EDAY4$<br />

E$DAY5 p1 LA A0,p1<br />

LMJ X11,EDAY5$<br />

Edits a date (mm/dd/yy).<br />

number of seconds since midnight<br />

Edits the date portion of A0 into the format<br />

mm/dd/yy<br />

where mm, dd, yy are the 2 digits of the month, day, and year,<br />

respectively.<br />

Edits a date (dd mmm yy).<br />

Edits the date portion of A0 into the format<br />

dd mmm yy<br />

where dd and yy are the 2 digits of the day and year,<br />

respectively, and mmm is a 3-character abbreviation for the<br />

month.<br />

Edits a date (month dd, year).<br />

Edits the date portion of A0 into the format<br />

month dd, year<br />

where month is the name of the month (up to 9 characters),<br />

dd is the day (one or two characters), and year is the 4-digit<br />

year.<br />

Edits a date (yearmmdd).<br />

Edits the date portion of A0 into the format<br />

yearmmdd<br />

where year is the 4-digit year, and mm and dd are the 2 digits<br />

of the month and day, respectively.<br />

Edits a date (yymmdd).<br />

8–8 7833 1733–004


EDIT$–Fieldata Image Composition Editing Package<br />

Table 8–3. Time and Date Editing Routines<br />

PROC Call Generated Instructions Description<br />

E$DAT5 ER TDATE$<br />

LMJ X11,EDAY5$<br />

E$TIME p1 LA A0,p1<br />

LMJ X11,ETIME$<br />

E$TD ER TDATE$<br />

LMJ X11,ETIME$<br />

Edits the date portion of A0 into the format<br />

yymmdd<br />

where yy, mm, and dd are the 2 digits of the year, month, and<br />

day, respectively.<br />

Edits a time.<br />

Edits the time portion of A0 into the format<br />

hh:mm:ss<br />

where hh, mm, and ss are the 2 digits of the hours, minutes,<br />

and seconds of the time, respectively.<br />

8.4. EDIT$F–Floating-Point Editing Routines<br />

The floating-point editing routines require three parameters in addition to the address of<br />

the floating-point packet. The first two are called x and y and are supplied in S5 and S6<br />

of A0. These parameters specify the format of the edited number as described below.<br />

The third parameter is the single- or double-precision number to be edited. If singleprecision,<br />

the number is specified in A1; if double-precision, the number is specified in<br />

A1 and A2.<br />

Edited numbers may appear in one of the two general formats: fixed-decimal format<br />

(no exponent) and scientific format. A number edited in fixed-decimal format consists of<br />

a sign (if negative) followed by the digits of the number and an embedded decimal point.<br />

The sign is present only if the number is negative; a positive number has no sign<br />

character.<br />

The parameter x specifies the width of the edited field, or the number of character<br />

positions the edited number will occupy, including sign and decimal point. If the value of<br />

x is too small to represent the value being edited, it is ignored, and as many character<br />

positions as necessary are used to correctly represent the number.<br />

The parameter y specifies how many fractional digits will be edited. This is the number<br />

of digits appearing to the right of the decimal point. The value of y may be any value<br />

greater than or equal to zero, but should always be less than the value of x to allow for<br />

the sign and decimal point characters.<br />

The scientific format is similar to the fixed-decimal format but has an exponent at the<br />

right. The exponent consists of an optional exponent character (usually 'E' for<br />

single-precision and 'D' for double-precision numbers) followed by the exponent's sign<br />

(either "+" or "-") and digits. Exponents of single-precision numbers are always edited as<br />

a 2-digit value, and those of double-precision numbers are always edited as a 3-digit<br />

value.<br />

7833 1733–004 8–9


EDIT$–Fieldata Image Composition Editing Package<br />

PROC Call<br />

The parameter x specifies the total number of character positions to be occupied by the<br />

edited number, including signs, digits, decimal point, and exponent character. If the<br />

edited numbers require more character positions than specified by the value of x, the<br />

parameter x is ignored, and the required character positions are used.<br />

The parameter y specifies the total number of mantissa digits to appear in the edited<br />

number. It includes the digits on both sides of the decimal point but not the decimal<br />

point itself. The placement of the decimal point within the y digits of the mantissa is<br />

determined by the value in the packet cell FPS. This is the number of digits to appear to<br />

the left of the decimal point. It is normally set to one.<br />

Table 8–4 describes the floating-point editing routines.<br />

Table 8–4. EDIT$F–Floating-Point Editing Routines<br />

Generated<br />

Instructions<br />

E$FLF1 x*/6+y,p LA A1,p<br />

LA,U A0,x*/6+y<br />

LMJ X11,EFLF1$<br />

E$FLF2 x*/6+y,p DL A1,p<br />

LA,U A0,x*/6+y<br />

LMJ X11,EFLF2$<br />

E$FLG1 x*/6+y,p LA A1,p<br />

LA,U A0,x*/6+y<br />

LMJ X11,EFLG1$<br />

E$FLG2 x*/6+y,p DL A1,p<br />

LA,U A0,x*/6+y<br />

LMJ X11,EFLG2$<br />

E$FLS1 x*/6+y,p LA A1,p<br />

LA,U A0,x*/6+y<br />

LMJ X11,EFLS1$<br />

E$FLS2 x*/6+y,p DL A1,p<br />

LA,U A0,x*/6+y<br />

LMJ X11,EFLS2$<br />

Description<br />

Single-precision fixed decimal format.<br />

A1 is edited to fixed decimal format with y digits following the<br />

decimal point, right-justified, in a field of size x.<br />

Double-precision fixed decimal format.<br />

A1, A2 is edited to fixed decimal format with y digits following<br />

the decimal point, right-justified, in a field of size x.<br />

Single-precision generalized format.<br />

Same as scientific format except that an attempt is made to<br />

move the decimal point in such a way as to reduce the<br />

exponent to zero. If this can be done, the exponent is set to<br />

blanks. Otherwise scientific format is used.<br />

Double-precision generalized format.<br />

See EFLG1$ and EFLS2$.<br />

Single-precision, scientific format.<br />

A1 is edited to scientific format with y significant digits in a<br />

field size of x. The exponent is 2 digits long.<br />

Double-precision, scientific format.<br />

A1, A2 is edited to scientific format with y significant digits in<br />

a field size of x. The exponent is 3 digits long.<br />

8–10 7833 1733–004


Section 9<br />

FDASC$–Fieldata/ASCII Data<br />

Conversion<br />

The Fieldata/ASCII conversion routine performs the following character string<br />

conversions:<br />

• Converts Fieldata strings to ASCII (see 9.1.1).<br />

• Converts ASCII strings to Fieldata (see 9.1.2).<br />

The Fieldata/ASCII conversion routine consists of the following two elements:<br />

• FDASC$<br />

− Converts the characters from the input string one word at a time and places<br />

them into the output string.<br />

− Space-fills the last word converted out to a word boundary. If the last word is all<br />

spaces after the space filling, then the length of the output string is decreased<br />

by one word.<br />

− Is reentrant and does not assume quarter/third-word mode.<br />

− Is a relocatable element in the file SYS$LIB$*<strong>SYSLIB</strong> and also collected in the<br />

<strong>SYSLIB</strong> common bank <strong>SYSLIB</strong>$3. The relocatable and common bank entry<br />

points for FDASC$ are listed in Appendix E.<br />

− May be called from MASM programs.<br />

• TABLE$<br />

Contains the conversion codes for Fieldata and ASCII characters.<br />

9.1. MASM Interface<br />

The calling program may call FDASC$ as a relocatable element, a common bank<br />

element, or a common bank element with the Auto Switch method.<br />

9.1.1. Fieldata to ASCII Conversion<br />

FDASC$ converts Fieldata character strings to ASCII when the FDASC$ entry point is<br />

called. The following table lists the calling sequences.<br />

7833 1733–004 9–1


FDASC$–Fieldata/ASCII Data Conversion<br />

Auto Switch Common Bank or Relocatable Relocatable<br />

L,U A0,input-buffer-word- count<br />

L,U A1,input-buffer-address<br />

L,U A2,output-buffer-address<br />

LMJ X11,CBFDASC$-1<br />

normal return<br />

L,U A0,input-buffer-word- count<br />

L,U A1,input-buffer-address<br />

L,U A2,output-buffer-address<br />

I$BJ X11,CBFDASC$<br />

normal return<br />

L,U A0,input-buffer-word- count<br />

L,U A1,input-buffer-address<br />

L,U A2,output-buffer-address<br />

LMJ X11,FDASC$<br />

normal return<br />

FDASC$ converts the Fieldata characters in the input buffer (six characters per word) to<br />

ASCII and places them into the output buffer (four characters per word, with trailing<br />

space-fill if necessary). The length of the output buffer in words must be at least 1-1/2<br />

times the length of the input buffer. The input buffer and the output buffer may specify<br />

the same buffer, since the string is converted tail-to-head to prevent overwriting.<br />

FDASC$ returns the word length of the converted ASCII image in register A0.<br />

Example<br />

The following example demonstrates a call to the relocatable version of FDASC$ to<br />

convert a Fieldata character string to ASCII:<br />

$FDATA<br />

$INCLUDE ‘MAXR$’<br />

$(2)<br />

INBUF ‘SOME FIELDATA CHARACTERS.’ . Fieldata character string<br />

INLEN $EQU $-INBUF . Word length<br />

OUTBUF $RES INLEN*3//2 . Output buffer<br />

PCW $GFORM 12,1, 6,0, 18,OUTBUF . Print Control Word<br />

$(1)<br />

START<br />

L,U A0,INLEN . Input string word length<br />

L,U A1,INBUF . Input string address<br />

L,U A2,OUTBUF . Output buffer address<br />

LMJ X11,FDASC$ . Convert FD to ASCII<br />

.<br />

S,S3 A0,PCW . Put word length of<br />

L A0,PCW . converted image in PCW<br />

ER APRINT$ . Print ASCII image<br />

.<br />

ER EXIT$ .<br />

$END START .<br />

This MASM routine calls the relocatable version of FDASC$ to convert the Fieldata string<br />

at INBUF to ASCII. The word length of the converted image is returned from FDASC$ in<br />

A0. An ER APRINT$ prints the converted image.<br />

9–2 7833 1733–004


9.1.2. ASCII to Fieldata Conversion<br />

FDASC$–Fieldata/ASCII Data Conversion<br />

FDASC$ converts ASCII character strings to Fieldata when the ASCFD$ entry point is<br />

called.<br />

The following table lists the calling sequences.<br />

Auto Switch Common Bank or Relocatable Relocatable<br />

L,U A0,input-buffer-word- count<br />

L,U A1,input-buffer-address<br />

L,U A2,output-buffer-address<br />

LMJ X11,CBASCFD$-1<br />

normal return<br />

L,U A0,input-buffer-word- count<br />

L,U A1,input-buffer-address<br />

L,U A2,output-buffer-address<br />

I$BJ X11,CBASCFD$<br />

normal return<br />

L,U A0,input-buffer-word- count<br />

L,U A1,input-buffer-address<br />

L,U A2,output-buffer-address<br />

LMJ X11,ASCFD$<br />

normal return<br />

ASCFD$ converts the ASCII characters in the input buffer (four characters per word) to<br />

Fieldata and places them in the output buffer (six characters per word, with trailing<br />

space-fill if necessary). The length of the output buffer in words must be at least twothirds<br />

the length of the input buffer. The input buffer and the output buffer may specify<br />

the same buffer, since the string is converted head to tail to prevent overwriting.<br />

ASCFD$ returns the word length of the converted Fieldata image in register A0.<br />

9.2. TABLE$–Fieldata/ASCII Conversion Table<br />

TABLE$ contains the conversion codes for each ASCII and Fieldata character. Each<br />

word of TABLE$ has the ASCII to Fieldata code in H1 and the Fieldata to ASCII code in<br />

H2. The H2 portion of TABLE$ is used when the FDASC$ entry point is called; the H1<br />

portion is used when the ASCFD$ entry point is called.<br />

TABLE$ is 256 words long and has an entry point of ASCFDASC$. The H2 portion of the<br />

last 192 words (Fieldata to ASCII codes) is unused.<br />

TABLE$ is a relocatable element in the file SYS$LIB$*<strong>SYSLIB</strong> and is also collected in the<br />

<strong>SYSLIB</strong> common bank <strong>SYSLIB</strong>$3.<br />

7833 1733–004 9–3


FDASC$–Fieldata/ASCII Data Conversion<br />

9–4 7833 1733–004


Section 10<br />

GETPSF$–Get a Scratch File Routine<br />

The GETPSF$ routine assigns program scratch files.<br />

10.1. File Assignment<br />

For greater efficiency, a common set of file names has been defined for use by system<br />

processors, language processors, and programs that require one or more scratch files.<br />

Based on the abbreviation PSF (program scratch file), these file names are PSF$, PSF1$,<br />

PSF2$...PSF9$.<br />

These files are generally assigned only once per run. The first program that requires a<br />

file calls GETPSF$ to perform the assignment and then leaves it assigned for subsequent<br />

use by other programs in the run. Since GETPSF$ does not initialize or clear the scratch<br />

files, programs must assume that there may be data in the scratch file left over from its<br />

previous use.<br />

Programs may call GETPSF$ to assign up to 10 PSF files. To avoid the extra expense of<br />

assigning scratch files to a run, request file PSF$ if only one file is needed. If two files<br />

are needed, request PSF$ and PSF1$. If this convention is followed, chances are greater<br />

that the file requested has already been assigned to the run. When a call to GETPSF$<br />

requests the assignment of a file that is already assigned to the run, the cost to the<br />

calling program is considerably less than if GETPSF$ actually has to assign a file.<br />

7833 1733–004 10–1


GETPSF$–Get a Scratch File Routine<br />

10.2. MASM Interface<br />

The next two subsections describe the packet and the calling sequence.<br />

10.2.1. Packet<br />

On a call to the relocatable version of the GETPSF$ routine, the calling program passes<br />

the number of files or the specific PSF file number to be assigned to the run.<br />

For a call to the common bank version of the routine, the calling program must also<br />

provide the address of a 13-word data area that is used by the GETPSF$ routine. This is<br />

a scratch data area that does not have to be initialized by the caller and can be reused by<br />

the calling program when control returns from GETPSF$. The packet must be in a writeenabled<br />

bank of the calling program. The bank must also be based when the call to the<br />

GETPSF$ routine is made.<br />

For more information on the different methods of calling the <strong>SYSLIB</strong> routines, see<br />

Section 3.<br />

10.2.2. Calling Sequence<br />

The GETPSF$ routine is called by the MASM procedure G$ETPSF. This procedure can<br />

be used to generate the calling sequence for the relocatable version, the common bank<br />

version, or the common bank version using the Auto Switch calling sequence.<br />

Calling Format<br />

G$ETPSF[,t] func-code [,n] [pkt-addr]<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

Call the relocatable version. This parameter is optional and may be omitted. CB or<br />

A, if specified, must be enclosed by apostrophes.<br />

blank Call the relocatable version. This is the default if t is omitted.<br />

'CB' Call the common bank version.<br />

'A' Call the common bank version using the Auto Switch method.<br />

10–2 7833 1733–004


func-code<br />

GETPSF$–Get a Scratch File Routine<br />

The function code tells GETPSF$ how to treat the parameter n. If the function code<br />

is set to GETPSF$, then the routine assigns scratch files in sequence beginning with<br />

file PSF$ and continuing to file PSFn$, where n is the number given as the second<br />

parameter.<br />

If the function code is set to GETPSFN$, then only one file is assigned by GETPSF$.<br />

That file is PSF$ if n is omitted or set to 0. If n is set to a value of 1 to 9, then the file<br />

PSFn$ is assigned. The function code must be enclosed by apostrophes. The only<br />

allowable function codes for GETPSF$ are<br />

GETPSF$<br />

Assign files PSF$ to PSFn$. If n is zero or is omitted, only file PSF$ is assigned.<br />

GETPSFN$<br />

Assign only file PSFn$. If n is zero or is omitted then file PSF$ is assigned.<br />

Note: Any other value entered for the function code parameter on the G$ETPSF<br />

procedure call causes MASM to generate an E flag on that line and print the error<br />

message.<br />

n<br />

ILLEGAL G$ETPSF FUNCTION<br />

The parameter n can be set to an integer value of 0 through 9. It may be given as an<br />

actual number, a tag that has been equated to a number or the address of a word<br />

that contains the number. The parameter n defines the highest numbered PSF file<br />

to be assigned if a group of files is requested (that is, if the function code is set to<br />

GETPSF$). Otherwise, n defines the particular PSF file to be assigned when the<br />

function code is set to GETPSFN$.<br />

If n is set to 2 and the function code is GETPSF$, then files PSF$, PSF1$, and PSF2$<br />

are assigned. If n is set to 2 and the function code is GETPSFN$, then only one file,<br />

PSF2$, is assigned.<br />

pkt-addr<br />

Address of the packet provided by the calling program to the GETPSF$ routine. This<br />

parameter is needed only if the parameter t has been set to 'A' or 'CB'. If t is set to<br />

'A' or 'CB', then this parameter must be included or the address of the packet must<br />

already be in register A1. If the parameter t is blank, that is, if the call is to the<br />

relocatable version of the GETPSF$ routine, then this parameter may be omitted.<br />

However, including it on the call does not cause any problems.<br />

If only the function code is given on the GETPSF$ procedure call, GETPSF uses the value<br />

in register A0 for n. If the parameter t has been set to A or CB, then the value in register<br />

A1 is used as the address of the packet required by the common bank routine.<br />

7833 1733–004 10–3


GETPSF$–Get a Scratch File Routine<br />

Normal Return<br />

If the normal return is taken, the requested files are assigned to the run as track granular,<br />

sector-addressable mass storage files with a maximum size of 3,000 granules. The<br />

GETPSF$ routines do not reassign PSF files. If a PSF file is already assigned and<br />

GETPSF$ is called to assign it again, the normal return is taken and the file remains<br />

exactly as it was before the call to GETPSF$.<br />

The first three characters of all files assigned by the GETPSF$ routines are always PSF.<br />

The last three characters vary, depending on how the GETPSF$ routine was called.<br />

These three characters are returned to the calling program in H1 of register A1 on a<br />

normal return.<br />

On a normal return from GETPSF$ when func-code=GETPSF$, H1 of register A1<br />

contains "$∆∆" if only the file PSF$ was requested or "n$∆", where "n" is the highest<br />

numbered PSF$ file requested. The symbol "∆" represents a blank.<br />

On a normal return from GETPSF$ when func-code=GETPSFN$, H1 of register A1<br />

contains "n$∆", where "n" is the number of the file requested or "$∆∆" if file PSF$ is<br />

requested.<br />

After a normal return, the calling program can store the content of register A1 into a<br />

Fieldata string that can be submitted by ER CSF$ to attach an internal file name to the<br />

PSF file using the @USE command. See the example.<br />

Error Return<br />

When the error return is taken, register A0 contains an error code with auxiliary<br />

information in other registers. The error codes are as follows:<br />

A0 = 0<br />

A0 = 1<br />

A0 = 2<br />

The input value n is negative or exceeds 9. Register A1 contains the value.<br />

A file is assigned to the run that is not in sector-addressable format. Register A1<br />

points to the FACIL$ packet.<br />

A CSF$ request was rejected. Register A1 points to the FACIL$ packet. Register A2<br />

contains the status bits returned by CSF$.<br />

10–4 7833 1733–004


Example<br />

$INCLUDE ‘MAXR$/’<br />

$(2)<br />

PSFNUM $EQU 3<br />

FUNCT $EQU ‘GETPSF$’<br />

VALUE + 3<br />

BUFFER $RES 13<br />

BUFFLN $EQU $-BUFFER<br />

CSFIMG ‘@USE SF,PSF ‘<br />

$(1)<br />

START .<br />

G$ETPSF,‘CB’ FUNCT,3 BUFFER<br />

J PSFERR<br />

LXI,U X11,0<br />

G$ETPSF ‘GETPSFN$’,PSFNUM BUFFER<br />

J PSFERR<br />

S A1, CSFIMG + 2<br />

L A0, (3, CSFIMG)<br />

ER CSF$<br />

JN A0, PSFERR<br />

LA,U A1,BUFFER<br />

G$ETPSF,‘CB’ ‘GETPSF$’,VALUE<br />

J PSFERR<br />

J DONE<br />

PSFERR .<br />

L$SNAP ‘PSFERR’,2,0,0<br />

DONE .<br />

ER EXIT$<br />

$END START<br />

GETPSF$–Get a Scratch File Routine<br />

The preceding examples all call the GETPSF$ routine to assign four temporary files to<br />

the run (files PSF$, PSF1$, PSF2$, and PSF3$). The last call does not include BUFFER<br />

as a parameter. Prior to making the call, the address of BUFFER must have been loaded<br />

into register A1. The internal filename "SF" is attached to filename "PSF3$."<br />

7833 1733–004 10–5


GETPSF$–Get a Scratch File Routine<br />

10–6 7833 1733–004


Section 11<br />

ID$–Identification Line Routine<br />

ID$ provides the calling program with an identification line or lines for any processor or<br />

program. ID$ identifies the processor called and the time it was called. The information<br />

in the identification line consists of a processor/program description, an optional date of<br />

creation and time for the processor/program, and the current (execution) date and time.<br />

The System Standard Format Date and Time (SFDT$) routine formats the dates and<br />

times. All output is in ASCII.<br />

ID$ can be called from both MASM and PLUS programs. ID$ is available as a relocatable<br />

element in the <strong>SYSLIB</strong> file SYS$LIB$*<strong>SYSLIB</strong> and also in the <strong>SYSLIB</strong> common bank<br />

<strong>SYSLIB</strong>$1. The relocatable and common bank entry points for ID$ are listed in<br />

Appendix E.<br />

ID$ Output<br />

The format of the identification line is<br />

Processor/program description (creation date and time) execution date and<br />

time<br />

where:<br />

Processor/program description<br />

The calling program provides this field; it can contain any number of ASCII<br />

characters. There are two methods to specify the description.<br />

• A separate buffer may contain the description; the address and length in<br />

characters are passed to ID$.<br />

• The description can be specified as a string on the I$DPKT procedure call that<br />

sets up the ID$ packet.<br />

Creation date and time<br />

ID$ obtains the date and time that the calling program was created from the<br />

Collector-supplied values for D$ATE and T$IME. ID$ places the date and time in<br />

parentheses using the following format: (YYMMDD HHMM:SS). Date and time are<br />

separated from the last character of the description by one space. This field can be<br />

excluded from the ID$ output.<br />

7833 1733–004 11–1


ID$–Identification Line Routine<br />

Execution date and time<br />

ID$ uses the current date and time unless a date and time are in the ID$ packet.<br />

(This should be the contents of R2 at load time.) Two formats are available: default is<br />

"CCYY mmm DD ddd HHMM:SS", or optionally "YYMMDD HHMM:SS". The date<br />

and time are separated from the last character of the creation date/time (or<br />

description if creation date/time is excluded) by one space.<br />

See SFDT$ routine comments for further details on the date/time formats.<br />

The calling program can format ID$ output for 80 characters per line (demand) or 132<br />

characters per line (batch or breakpointed-demand). If the length of the output exceeds<br />

the maximum character length of a line, the remainder is continued on the following line.<br />

If the creation date/time or execution date/time does not fit on one line, they are placed<br />

entirely on the next line (there is no wraparound for date/time).<br />

Sample displays of an ASCII string generated by ID$.<br />

1. MASM 3R1T1 (800827 1448:46) 1983 Sep 10 Sat 1651:18<br />

2. FURPUR 28R3 File Utility Routine/Program File Utility Routine<br />

(820312 1356:02) 1984 May 11 Fri 1017:24<br />

11.1. MASM Interface<br />

The ID$ routine may be called directly from MASM programs. Subsection 11.3<br />

describes the ID$ packet format and the MASM PROC I$DPKT that generates the<br />

packet. Subsection 11.1.2 describes the calling sequence for ID$, the MASM PROC<br />

I$D$ to call ID$, and the MASM PROC I$DPRINT to print the output.<br />

11.1.1. Packet<br />

The calling program must provide ID$ with an 11-word (or more) packet. The ID$ packet<br />

format is described in 11.3, and the PROC to generate the ID$ packet is described<br />

below.<br />

The MASM PROC I$DPKT generates the packet for the ID$ routine.<br />

Calling Format<br />

label I$DPKT {idlen | idbuf | ‘bufname’} {hdrlen | hdrbuf | ‘string’} optbits<br />

11–2 7833 1733–004


Parameters<br />

label<br />

A label to identify the start of the ID$ packet.<br />

idlen,idbuf<br />

ID$–Identification Line Routine<br />

idlen is the length in words of the ID$ output buffer. idbuf is the address of the ID$<br />

output buffer.<br />

'bufname'<br />

A label that identifies the output buffer which is generated immediately after the ID$<br />

packet. This eliminates the need for a separately defined output buffer.<br />

hdrlen,hdrbuf<br />

'string'<br />

optbits<br />

hdrlen is the length in characters of the processor/program description. hdrbuf is the<br />

address of the buffer containing the processor/program description.<br />

The ASCII character string used as the processor/program description, which is<br />

stored immediately after the ID$ packet. This eliminates the need for a separate<br />

description buffer and length.<br />

Octal number with the following bit significance (rightmost bit is 35):<br />

Bit 35<br />

Bit 34<br />

Bit 33<br />

Clear: maximum characters per line is 80.<br />

Set: maximum characters per line is 132.<br />

Clear: include the creation date and time.<br />

Set: exclude the creation date and time.<br />

Clear: use long execution date/time format.<br />

Set: use short execution date/time format.<br />

7833 1733–004 11–3


ID$–Identification Line Routine<br />

Bit 32<br />

Bit 31<br />

Clear: line spacing for first PCW is 1 (next line).<br />

Set: line spacing for first PCW is 07777 (top of page).<br />

Clear: do not print the ID$ output.<br />

Set: call I$DPRINT to print all ID$ output.<br />

The following are two examples of generating the ID$ packet with I$DPKT:<br />

Example 1<br />

$(2)<br />

IDPACKET I$DPKT ‘IDOUTPUT’ ‘Collector 31R1’<br />

In example 1, the I$DPKT procedure generates an 11-word packet at location IDPACKET<br />

under location counter 2. The I$DPKT procedure also allocates space following the ID$<br />

packet for a buffer, which will contain the ID$ output. IDOUTPUT specifies the location<br />

of the first word of this buffer. I$DPKT determines the length of the buffer (in this<br />

example, 14 words).<br />

I$DPKT also stores the ASCII string 'Collector 31R1' following the ID$ packet. The<br />

options bits parameter is omitted. This sets all option bits to zero.<br />

Example 2<br />

$(4)<br />

IDPAC I$DPKT 20,IDLINE 27,PGMIDENT 026<br />

IDLINE $RES 20<br />

PGMIDENT ‘Math Quiz Program (Level 8)’<br />

In example 2, the I$DPKT procedure generates an 11-word packet at location IDPAC<br />

under location counter 4. ID$ generates the identification line in the 20-word data area at<br />

location IDLINE. ID$ uses the 27-character string at location PGMIDENT for the program<br />

description part of the identification line.<br />

The octal code 026 sets condition bits 34, 33, and 31. This directs ID$ to exclude the<br />

creation date and time from the identification line, use the short format for execution<br />

data and time, and print the identification line.<br />

11–4 7833 1733–004


11.1.2. Calling Sequence<br />

ID$–Identification Line Routine<br />

ID$ is called with the MASM PROC I$D$. This PROC can call ID$ as a relocatable<br />

element, a common bank element, or a common bank element using the Auto Switch<br />

method.<br />

Calling Format<br />

I$D$[,t] pkt-addr date<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

The type of call to ID$. This parameter is optional and may be omitted. CB or A,<br />

if specified, must be enclosed by apostrophes.<br />

pktaddr<br />

date<br />

blank Call the relocatable version of ID$. This is the default if t is omitted.<br />

'CB' Call the common bank version of ID$.<br />

'A' Call the common bank version of ID$ using the Auto Switch method.<br />

The address of the ID$ packet.<br />

The address of a caller-specified date and time (it must be in TDATE$ format). This<br />

parameter is optional.<br />

The calling program can use indexing, incrementation, indirect addressing, and register<br />

basing in specifying the addresses for pktaddr and date by using the $EQUF directive.<br />

See $EQUF definitions in the MASM <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

If date is included on the calling statement, the TDATE$ value at that address is used for<br />

the execution date/time. If the date is excluded, the TDATE$ value in word 8 of the ID$<br />

packet is used. If no value is present in Word 8, in other words, if it is zero, the current<br />

date/time is obtained from ER TDATE$.<br />

7833 1733–004 11–5


ID$–Identification Line Routine<br />

Error Return<br />

If ID$ takes the error return, either A1 or A2 contains a negative error code. If the error<br />

occurred in ID$, A1 contains the error code. If the error occurred in SFDT$, A2 contains<br />

the error code.<br />

• ID$ error codes (returned in A1)<br />

-01 An outdated version of the ID$ packet is being used.<br />

• SFDT$ error codes (returned in A2)<br />

-01 through -05 SFDT$ routine error; see Section 22.<br />

The error code is also stored in the packet, in ERRCODE.<br />

ID$ Output<br />

The output ID$ generates may be one or more lines. This depends on the length of the<br />

processor/program description and specified options. For each line of ID$ output, a print<br />

control word is constructed (line spacing, image length, image address) and stored<br />

sequentially in the ID$ packet starting with word 10. The number of print control words<br />

constructed is stored in S6 of word 0 of the ID$ packet.<br />

The following procedure simplifies printing of the ID$ output:<br />

I$DPRINT pktaddr<br />

where pktaddr is the address of the ID$ packet.<br />

This procedure performs an APRINT$ for each print control word. It may be called from<br />

the I$D$ PROC by setting option bit 31.<br />

All output from ID$ is directed to the current print file.<br />

Normal Return<br />

If the normal return occurs, the first print control word is returned in A0.<br />

11–6 7833 1733–004


11.1.3. Examples<br />

ID$–Identification Line Routine<br />

The following example calls the ID$ routine to generate an ASCII identification line.<br />

$ASCII<br />

$INCLUDE ‘MAXR$’<br />

$(2)<br />

IDPAC I$DPKT ‘IDLINE’ ‘Math Quiz Program (Level 8)’ 026<br />

$(1)<br />

START<br />

I$D$ IDPAC . Generate and print the ID line<br />

J ERROR . Jump ahead if error return<br />

.<br />

. (Program code)<br />

.<br />

J DONE . Program complete<br />

ERROR<br />

L$SNAP ‘ID$’, 2 . Dump the A-registers<br />

DONE<br />

ER EXIT$<br />

$END START<br />

This MASM routine uses the ID$ routine to create and print the following identification<br />

line:<br />

Math Quiz Program (Level 8) 840425 1147:31<br />

In this example, ID$ generates the ASCII identification line in the 11-word data area at<br />

location IDLINE. The I$DPKT procedure generates the ID$ packet (see11.2.2 for details<br />

on the I$DPKT packet generation PROC).<br />

The I$D$ procedure calls the relocatable version of ID$, which generates the<br />

identification line and prints it by executing an ER APRINT$ (because option bit 4 is set).<br />

If ID$ takes the error return, L$SNAP prints the A-registers. Otherwise, the program<br />

continues executing.<br />

7833 1733–004 11–7


ID$–Identification Line Routine<br />

11.2. PLUS Interface<br />

ID$ can be called directly from PLUS programs. The data structure requirements for ID$<br />

are described in 11.1.2. The calling sequence for ID$ is described in 11.2.2.<br />

When ID$ is called from PLUS programs, the output is limited to a maximum of 10 lines<br />

for the processor/program identification line(s).<br />

11.2.1. Packet<br />

PLUS programs that call ID$ do not need to supply a packet for ID$. Instead, the calling<br />

program passes parameters to ID$, and ID$ builds the packet on the Automatic Storage<br />

Stack (PLSSTACK).<br />

The calling program must provide the following data entities:<br />

• A buffer containing the ASCII processor/program description. It may be any length<br />

up to ten times the maximum number of characters per line, minus the number of<br />

characters needed for the date/time output fields. (Date/time fields require 41 or<br />

fewer characters, depending on specified options.) The length of this buffer must be<br />

passed to ID$ in character granularity.<br />

• A buffer to contain the ASCII output from ID$. It must be long enough to contain the<br />

entire output string (at most 41 characters longer than the description). ID$ will<br />

space-fill this buffer to its end. The length of the buffer must be passed to ID$ in<br />

word granularity.<br />

• A 36-bit signed integer used to return error codes from ID$ to the calling program.<br />

The above data entities must be declared LOCATABLE. These data entities are passed<br />

to ID$ to create the identification line.<br />

11.2.2. Calling Sequence<br />

The following procedure declaration is required to call the ID$ routine. This procedure<br />

must be declared by the calling program.<br />

PROCEDURE ID_LINE( ID_OUTPUT_ADDRESS: 36 BIT MACHINE POINTER,<br />

ID_OUTPUT_LENGTH: 36 BIT SIGNED INTEGER,<br />

ID_NAME_ADDRESS: 36 BIT MACHINE POINTER,<br />

ID_NAME_LENGTH: 36 BIT SIGNED INTEGER,<br />

ID_DATE: 36 BIT MACHINE LOGICAL,<br />

ID_OPTIONS: 36 BIT SIGNED INTEGER,<br />

%ID_ERROR_CODE: 36 BIT SIGNED INTEGER)<br />

IMPORTED (‘external-name’);<br />

11–8 7833 1733–004


Parameters<br />

ID_OUTPUT_ADDRESS<br />

ID$–Identification Line Routine<br />

The address of the buffer that will contain the ASCII output from ID$.<br />

ID_OUTPUT_LENGTH<br />

The length in words of the output buffer.<br />

ID_NAME_ADDRESS<br />

The address of the buffer containing the ASCII processor/program description.<br />

ID_NAME_LENGTH<br />

The length in characters of the processor/program description buffer.<br />

ID_DATE<br />

The execution date and time; it may be a value in TDATE$ format, or set to minus<br />

one (-1) to use current date and time.<br />

ID_OPTIONS<br />

Bit 36<br />

Bit 35<br />

Bit 34<br />

Bit 33<br />

An octal number that specifies which options ID$ uses (bit 36 is the rightmost bit of<br />

ID_OPTIONS).<br />

Clear: maximum characters per line is 80.<br />

Set: maximum characters per line is 132.<br />

Clear: include the creation date and time.<br />

Set: exclude the creation date and time.<br />

Clear: use long execution date/time format.<br />

Set: use short execution date/time format.<br />

Clear: line spacing for first PCW is 1 (next line).<br />

Set: line spacing for first PCW is 07777 (top of page).<br />

7833 1733–004 11–9


ID$–Identification Line Routine<br />

Bit 32<br />

Clear: do not print the ID$ output.<br />

Set: Print the ID$ output.<br />

ID_ERROR_CODE<br />

Contains the error code (if any) returned by ID$.<br />

external-name<br />

One of two entry points to ID$:<br />

ID$P<br />

ID$PG<br />

For modules compiled without the G option. Calls the relocatable version of ID$.<br />

For modules compiled with the G option (I$BJ procedure and function calling<br />

sequence). Calls the common bank version of ID$.<br />

If after calling ID_LINE, ID_ERROR_CODE is zero, then the call to ID_LINE was<br />

successful; ID_OUTPUT_ADDRESS now contains the output string. If<br />

ID_ERROR_CODE is negative, an error occurred (see 11.1.2).<br />

11–10 7833 1733–004


11.2.3. Example<br />

The following example uses ID$ in a PLUS program:<br />

MODULE;<br />

DECLARE ID_BUFFER: 80 ASCII CHARACTERS LOCATABLE,<br />

DESCRIPTION: 32 ASCII CHARACTERS LOCATABLE,<br />

ERROR: 36 BIT SIGNED INTEGER LOCATABLE;<br />

"<br />

PROCEDURE ID_LINE( ID_OUTPUT_ADDRESS: 36 BIT MACHINE POINTER,<br />

ID_OUTPUT_LENGTH: 36 BIT SIGNED INTEGER,<br />

ID_NAME_ADDRESS: 36 BIT MACHINE POINTER,<br />

ID_NAME_LENGTH: 36 BIT SIGNED INTEGER,<br />

ID_DATE: 36 BIT MACHINE LOGICAL,<br />

ID_OPTIONS: 36 BIT SIGNED INTEGER,<br />

%ID_ERROR_CODE: 36 BIT SIGNED INTEGER)<br />

IMPORTED (‘ID$P’);<br />

.<br />

.<br />

.<br />

DESCRIPTION:= ‘Weekly Status Reports’;<br />

ID_LINE(LOC(ID_BUFFER),20,LOC(DESCRIPTION),21,-1,0’32’,%ERROR);<br />

.<br />

.<br />

ID$–Identification Line Routine<br />

In this example, the calling program calls the relocatable version of ID$. ID$ places the<br />

identification line into "ID_BUFFER", with no creation date and time. The ID$ routine<br />

uses the current date and time for the creation date and time. ID$ places output at the<br />

top of the next page and sends it immediately to the current print file.<br />

7833 1733–004 11–11


ID$–Identification Line Routine<br />

11.3. Packet Format<br />

The following shows the ID$ packet format. The calling program must provide<br />

appropriate values for the fields in italics.<br />

0 tscell pktvers pktlen linelim qwmflg numpcw<br />

01 optbits idlen hdrlen<br />

02 idbuf<br />

03 hdrbuf<br />

04 numwrds datefmt timefmt reserved (must be zero) sfdtvers<br />

05 offset sfdtnch sfdtlen errcode<br />

06 sfdtbuf<br />

07 crdate<br />

010 exdate<br />

011 X11save<br />

012 pcword<br />

012+1 pcword 1<br />

012+n pcword n<br />

Packet Fields<br />

tscell<br />

pktvers<br />

pktlen<br />

linelim<br />

bufspace<br />

Available to the calling program as a test-and-set cell (optional).<br />

The packet version number (for code maintenance only). The current version is 1<br />

(required).<br />

The length in words of the ID$ packet (required). This includes the length through<br />

the last allocated PCW.<br />

qwmflg<br />

The maximum length in words of the output lines (either 20 or 33 words) (required).<br />

Quarter Word Mode flag; set to a positive value if ID$ changes to QWM; otherwise<br />

zero.<br />

11–12 7833 1733–004


numpcw<br />

optbits<br />

idlen<br />

hdrlen<br />

idbuf<br />

hdrbuf<br />

Number of Print Control Words necessary for the ID$ output.<br />

The octal number that specifies available ID$ options (optional).<br />

The length in words of the ID$ output buffer (required).<br />

ID$–Identification Line Routine<br />

The length in characters of the processor/program description (required).<br />

The address of the ID$ output buffer (required).<br />

The address of the buffer containing the processor/program description (required).<br />

numwrds<br />

datefmt<br />

timefmt<br />

A running total of the number of words written out to the current output line.<br />

The date format index for SFDT$.<br />

The time format index for SFDT$.<br />

sfdtvers<br />

offset<br />

The SFDT$ packet version; see SFDT$ routine (Section 22) for the current version<br />

(required).<br />

sfdtnch<br />

sfdtlen<br />

The character offset within the first word (0 to 3) of the ID$ output (optional).<br />

The number of characters that SFDT$ writes.<br />

The length in words of output buffer for SFDT$.<br />

7833 1733–004 11–13


ID$–Identification Line Routine<br />

errcode<br />

sfdtbuf<br />

crdate<br />

exdate<br />

A negative error code returned from ID$ or SFDT$.<br />

The address for output from SFDT$ (contained within the ID$ output buffer).<br />

If the MASM PROC, I$DPKT, is not used to generate this packet, crdate must be<br />

specified by the user if optbits bit 34 is clear. For example, this value can be entered<br />

as<br />

+ D$ATE*/18+T$IME<br />

which will then be resolved at collection time. The value contained in this word will<br />

be interpreted as a date and time, whether or not it was specified as such. If a value<br />

of zero is used, the current date and time at execution will appear on the ID line in<br />

the position of the creation date and time.<br />

The execution date and time in TDATE$ format (optional).<br />

X11save<br />

pcword<br />

Storage space for return address.<br />

Storage space for the first ID$ output print control word (PCW).<br />

pcword n<br />

Storage spaces for n additional PCWs, when more than one PCW is required for the<br />

ID$ output. If the ID image is longer than that allowed by the number of allocated<br />

PCWs, the ID line is truncated.<br />

bufspace<br />

Storage space reserved for the ID$ output buffer, the processor/program description<br />

buffer, or both. Space is reserved only if requested in packet generation (see the<br />

I$DPKT description), and allocated immediately after the ID$ packet.<br />

Words 4 to 8 of the ID$ packet are the packet for SFDT$ (Standard Format Date and<br />

Time routine).<br />

11–14 7833 1733–004


Section 12<br />

INFOR$–Internal Format Table Interface<br />

Routines<br />

The INFOR interface routines read the INFOR table into memory, search through the<br />

table for specific information, retrieve information from the INFOR table, and dynamically<br />

assign internal use names to files.<br />

The INFOR routines can be included in the calling program as relocatable elements or<br />

can be referenced from one of the <strong>SYSLIB</strong> common banks by either the I$BJ or the Auto<br />

Switch method. For a complete description of these calling methods see Section 3.<br />

Appendix E includes a list of the <strong>SYSLIB</strong> common bank names and the routines included<br />

in them.<br />

Internal format (INFOR) refers to the data format used to pass information from the<br />

processor call statement to a program when it is called as a processor instead of being<br />

called by an @XQT command. The difference between calling a program as a processor<br />

and calling it by an @XQT statement is how the first read instruction of the program is<br />

executed. If the program is called by the @XQT command:<br />

@XQT PROGRAM file.element/version<br />

then there is nothing different about how the first read instruction is executed. It is<br />

executed like any other read in the program. When the read instruction is encountered<br />

the program stops and waits for data to be entered. The extra information entered on<br />

the call line, (in this example, file.element/version,) is ignored. If the program is called as<br />

a processor:<br />

@PROGRAM file.element/version<br />

then the first read receives information from the processor call statement in internal<br />

format. More than one read command may be needed to read all the information.<br />

When all information has been read into memory, it is refered to as the INFOR table.<br />

A processor can accomplish this by calling the INFOR$ routine RINF$ (Read Internal<br />

Format). Having the data from the call line placed in a table with a predefined format and<br />

then having a common set of routines to access this table gives processors a fast and<br />

efficient means of getting at the information they need.<br />

7833 1733–004 12–1


INFOR$–Internal Format Table Interface Routines<br />

12.1. Format of the Internal Format Table<br />

See Appendix G for the structure of the INFOR table and the identifiers used to<br />

reference the information it contains.<br />

12.2. General Considerations for Using the INFOR<br />

Routines<br />

If the calling program uses the relocatable version of the INFOR$ routines, the INFOR$<br />

routine allocates a 28-word packet under location counter 2. Normally this results in the<br />

area being defined in the calling program data bank. The actual location of the packet<br />

can be specified by the calling program through the use of Collector directives that<br />

define where data items under specific location counters are to be put. The following<br />

data area labels are externally defined by the relocatable version of the INFOR$ routines.<br />

These labels reference data areas in the 28-word packet and, since they are externalized,<br />

they can be used by the calling program.<br />

INFOR$<br />

Flag used by RINF$ to determine if the INFOR table has already been read.<br />

INFOR$+1<br />

FILE$<br />

ELT$<br />

Contents of A0 after first READ$ performed by RINF$ (status bits, CLIST$ index, and<br />

so on).<br />

Edited file name from DUSE$ (8 words).<br />

Field description table from SELT$ (14 words).<br />

If the calling program uses the common bank form of the INFOR$ routines, the calling<br />

program must provide a 30-word packet in a write-enabled bank that is based when the<br />

call to the INFOR$ routine is made. This packet can be generated by including a call to<br />

the procedure I$NFORPKT in the calling program code. This procedure reserves 30<br />

words of space and externalizes the data area tags INFOR$, FILE$, and ELT$. (See the<br />

definitions for INFOR$, FILE$, and ELT$ listed above.)<br />

The I$NFORPKT procedure should not be used when the relocatable version of INFOR$<br />

is called because the procedure I$NFORPKT and the relocatable version of INFOR$<br />

externalizes these tags.<br />

12–2 7833 1733–004


INFOR$–Internal Format Table Interface Routines<br />

The only values allowed for the function code on the I$NFOR procedure call are RINF$,<br />

SINF$, SELT$, and DUSE$. Any other value entered for the function code parameter on<br />

the I$NFOR procedure call causes MASM to generate an E flag on that line and print the<br />

error message:<br />

ILLEGAL I$NFOR FUNCTION<br />

All of the code in the INFOR$ routines is I-bank reentrant. The INFOR$ code is quarterword<br />

and third-word insensitive.<br />

12.3. INFOR$–Routines<br />

The INFOR$ routines are a set of routines that read and manipulate the INFOR table.<br />

The INFOR$ routines are:<br />

• RINF$<br />

Read the INFOR table into memory.<br />

• SINF$<br />

Search the INFOR table for a specification subfield.<br />

• SELT$<br />

Transfer a subfield from the INFOR table to the ELT$ table.<br />

• DUSE$<br />

Perform a dynamic @USE to attach an internal name to a file (see ECL and FURPUR<br />

<strong>Reference</strong> <strong>Manual</strong>.<br />

Limitation of INFOR Routines<br />

Because the field number (the FN subfield, see Appendix G) is limited to 6 bits, only 63<br />

fields (octal 1 to octal 77) can be uniquely numbered in the INFOR table. If more than 63<br />

fields are given, then the field numbers start over going from 1 to 63 again. For<br />

example, if a processor had 68 parameters on its call line, all 68 parameters would be<br />

included in the INFOR table. However, they would be numbered 1 to 63 and then 1 to 5.<br />

In this case, the INFOR$ routines SINF$ and SELT$ cannot be used to access the last<br />

five fields.<br />

The field number given on these calls must be in the range of 1 to 63, and the<br />

information returned would always come from one of the first 63 fields. If a programmer<br />

wishes to allow more than 63 parameters on the call line, the RINF$ routine can be used<br />

to create the INFOR$ table but all subsequent processing of the data would have to be<br />

done by the processor itself.<br />

7833 1733–004 12–3


INFOR$–Internal Format Table Interface Routines<br />

12.3.1. RINF$–Read INFOR Table<br />

The RINF$ routine performs a read operation to read the INFOR table and store it in an<br />

area that the calling program supplies. The RINF$ routine must be called before the<br />

SINF$, the SELT$, or the DUSE$ routines may be used.<br />

INFOR$ is a word defined externally by the INFOR$ routine. If it is zero, then the RINF$<br />

routine executes a read instruction and reads the INFOR table into the area indicated by<br />

parameter start-addr. If INFOR$ is not zero, RINF$ assumes that the INFOR table has<br />

already been read and immediately does a normal return to the caller. The calling<br />

program must set INFOR$ to zero if the calling program is reusable and is making<br />

multiple calls to the RINF$ routine.<br />

The RINF$ routine is called by the MASM procedure I$NFOR. This procedure can be<br />

used to generate the calling sequence for the relocatable version of the RINF$ routine,<br />

the common bank version of the routine, or the common bank version of the routine<br />

using the Auto Switch calling sequence. Section 3 describes the advantages and<br />

disadvantages of using the different types of calls.<br />

Calling Format<br />

I$NFOR[,t] ‘RINF$’[,word-count,start-addr] [packet]<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

RINF$<br />

Type of call to RINF$. This parameter is optional and may be omitted. CB or A, if<br />

specified, must be enclosed by apostrophes.<br />

blank Call the relocatable version of RINF$. This is the default if t is omitted.<br />

'CB' Call the common bank version of RINF$.<br />

'A' Call the common bank version of RINF$ using the Auto Switch method.<br />

RINF$ is the function code which specifies which of the INFOR$ routines the<br />

procedure I$NFOR should call. It must be enclosed by apostrophes.<br />

word-count<br />

Length in words of the memory area provided by the caller into which the RINF$<br />

routine is to store the INFOR table. If this parameter is omitted, the RINF$ routine<br />

uses the value in H1 of register A0 as the length.<br />

12–4 7833 1733–004


INFOR$–Internal Format Table Interface Routines<br />

To determine the length of the memory area needed to store the INFOR table, see the<br />

section, "Determining the INFOR Table Size" in Appendix G. After this size value is<br />

calculated, add 28 to it. The additional 28 words are needed because one extra word is<br />

used for a word of zeroes that RINF$ puts after the last word of the INFOR table and 27<br />

extra words are used as an overflow area when RINF$ reads the last block of INFOR<br />

data.<br />

Word-count = (size value calculated using Appendix G) + 28.<br />

start-addr<br />

packet<br />

Address of the data area in which the RINF$ routine stores the INFOR table. If this<br />

parameter is omitted, the RINF$ routine uses the value in H2 of register A0 as the<br />

starting address of the data area.<br />

Address of the 30-word packet required by the common bank version of INFOR$<br />

routine. This parameter is ignored unless parameter t is set to 'A' or 'CB'. If the<br />

common bank version of the RINF$ routine is being called and this parameter is<br />

omitted, then the routine assumes the address has already been loaded into register<br />

A2 by the calling program.<br />

Returns<br />

If the normal return is taken, the INFOR table has been read into the area specified by<br />

parameter start-addr followed by a zero-filled word. H2 of register A1 contains the<br />

address of this word.<br />

If the error return is taken, register A1 contains the error code and register A0 contains<br />

the PRINT$ control word for the error message. Table 12–1 lists the possible messages.<br />

Table 12–1. INFOR$: RINF$ Error Messages<br />

Error Code Error Message and Description<br />

1 PROCESSOR CALL ERROR<br />

Data images were returned on the first call to READ$, indicating that no INFOR<br />

table was created for this program.<br />

2 ABNORMAL RETURN FROM READ$<br />

READ$ returned with an end-of-file or other status that indicates this program<br />

has neither an INFOR table nor input data images.<br />

3 TOO MANY SPECIFICATIONS<br />

The buffer area is not large enough to hold the INFOR table.<br />

7833 1733–004 12–5


INFOR$–Internal Format Table Interface Routines<br />

12.3.2. SINF$–Search INFOR Table<br />

SINF$ searches the INFOR table (previously read by RINF$; see 12.3.1) for a<br />

specification subfield.<br />

The SINF$ routine is called by the MASM procedure I$NFOR. This procedure can be<br />

used to generate the calling sequence for the relocatable version of the routine, the<br />

common bank version of the routine, or the common bank version of the routine using<br />

the Auto Switch calling sequence. Section 3 describes the advantages and<br />

disadvantages of using the different types of calls.<br />

Calling Format<br />

I$NFOR[,t] ‘SINF$’[,ftfnsfn] [packet]<br />

no-find-return<br />

find return<br />

Parameters<br />

t<br />

SINF$<br />

ftfnsfn<br />

Type of call to SINF$. This parameter is optional and may be omitted. CB or A,<br />

if specified, must be enclosed by apostrophes.<br />

blank Call the relocatable version of SINF$. This is the default if t is omitted.<br />

'CB' Call the common bank version of SINF$.<br />

'A' Call the common bank version of SINF$ using the Auto Switch method.<br />

SINF$ is the function code which specifies which of the INFOR$ routines the<br />

procedure I$NFOR should call. It must be enclosed by apostrophes.<br />

Subfield specification that the SINF$ routine is to search for.<br />

ft Field type (see FT in Appendix G)<br />

fn Field number (see FN in Appendix G)<br />

sfn Subfield number (see SFN in Appendix G)<br />

The field type value may only be 1 (specification field). If 0 is specified, SINF$ will<br />

use a field type value of 1. The field number value may be equal to or greater than<br />

01. The subfield number may be a number between 01 and 10 8 . For example, to<br />

return the element name subfield of field 3, the parameter would be set to 010306.<br />

If this parameter is omitted, the SINF$ routine assumes the calling program has<br />

already loaded the information into H2 of register A0.<br />

12–6 7833 1733–004


packet<br />

INFOR$–Internal Format Table Interface Routines<br />

Address of the 30-word packet required by the common bank version of INFOR$<br />

routine. This parameter is ignored unless parameter t is set to 'A' or 'CB'. If the<br />

common bank version of the SINF$ routine is being called and this parameter is<br />

omitted, then the routine assumes the address has already been loaded into register<br />

A2 by the calling program.<br />

Returns<br />

There is a special case where an element name is preceded by a period and entered<br />

without a filename.<br />

@processor .element<br />

This is normally interpreted to mean that the file name for the present subfield is either<br />

TPF$ (if it is the first subfield) or it is the same file name as in the previous subfield.<br />

When SINF$ is used to retrieve the element name and this condition exists, SINF$<br />

makes a normal find-return to the calling program with the element name in the register<br />

pair A0,A1 and sets the FCI field in the subfield control word to an octal 75. (Octal 75 is<br />

the Fieldata code for a period.) Register A2 contains the address of the subfield control<br />

word and the following test can be used to detect this condition.<br />

TNZ,S4 0,A2<br />

The instruction immediately after the TNZ will be skipped if the element name was given<br />

on the processor call line with a leading period but no file name.<br />

Another special case is when there is no qualifier in a field but an asterisk precedes the<br />

file name.<br />

@processor *file.<br />

In this case, if SINF$ is used to retrieve the qualifier, it makes a normal find-return to the<br />

calling program with blanks in the register pair A0,A1. When the processor call line<br />

specifies a file name with no qualifier or leading asterisk<br />

@processor file.<br />

SINF$ takes the no-find-return if asked to retrieve the qualifier.<br />

When a find-return occurs, the registers contain:<br />

A0,A1 the contents of the specified subfield in Fieldata (left-justified, space-filled).<br />

A2 (H2) location of subfield control word (see Appendix G).<br />

A3 number of characters.<br />

When a no-find-return occurs, A2 points to the word that stopped the search. If this<br />

word is zero, the end of the INFOR table has been reached.<br />

7833 1733–004 12–7


INFOR$–Internal Format Table Interface Routines<br />

12.3.3. SELT$–Transfer to ELT$ Table from INFOR Table<br />

The SELT$ routine transfers a field from the INFOR table to the ELT$ table.<br />

The SELT$ routine is called by the MASM procedure I$NFOR. This procedure can be<br />

used to generate the calling sequence for the relocatable version of the SELT$ routine,<br />

the common bank version of the routine, or the common bank version of the routine<br />

using the Auto Switch calling sequence. Section 3 describes the advantages and<br />

disadvantages of using the different types of calls.<br />

Calling Format<br />

I$NFOR[,t] ‘SELT$’[,ftfn] [packet]<br />

no-find return<br />

find-return<br />

Parameters<br />

t<br />

SELT$<br />

ftfn<br />

Type of call to SELT$. This parameter is optional and may be omitted. If CB or A is<br />

specified, it must be enclosed by apostrophes.<br />

blank Call the relocatable version of SELT$. This is the default if t is omitted.<br />

'CB' Call the common bank version of SELT$.<br />

'A' Call the common bank version of SELT$ using the Auto Switch method.<br />

SELT$ is the function code which specifies which of the INFOR$ routines the<br />

procedure I$NFOR should call. It must be enclosed by apostrophes.<br />

Field that is transferred to the ELT$ table from the INFOR table. If this parameter is<br />

omitted, the SELT$ routine uses the value in H2 of register A0. The value in S5 of<br />

A0 is the field type and the value in S6 of A0 is the field number of the field to be<br />

transferred.<br />

ft Field type (see FT in Appendix G).<br />

fn Field number (see FN in Appendix G).<br />

The field type value may only be 1 (specification field). If 0 is specified, SELT$ will<br />

use a field type value of 1. The field number value may be 1 or greater.<br />

12–8 7833 1733–004


packet<br />

INFOR$–Internal Format Table Interface Routines<br />

Address of the 30-word packet required by the common bank version of INFOR$<br />

routine. This parameter is ignored unless parameter t is set to 'A' or 'CB'. If the<br />

common bank version of the SELT$ routine is being called and this parameter is<br />

omitted, then the routine assumes the address has already been loaded into register<br />

A2 by the calling program.<br />

ELT$ Table Format<br />

Figure 12–1 displays the ELT$ table fields.<br />

0 5 6 11 12 17 18 23 24 29 30 35<br />

ELT$+0 FQL FNL FCL RKL WKL IQF<br />

+1 ENL EVL ECL CFN ECC BEC<br />

+2 FQUAL<br />

+3 (two words)<br />

+4 FNAME<br />

+5 (two words)<br />

+6 FCYC<br />

+7 RKEY<br />

+8 WKEY<br />

+9 ENAME<br />

(two words)<br />

+11 EVER<br />

(two words)<br />

ELT$+13 ECYC<br />

Figure 12–1. INFOR$: Format of the ELT$ Table<br />

The Assembler procedure, ELT$, defines the field names in the ELT$ table (see Figure<br />

12–1) as EQUF and EQU directives.<br />

7833 1733–004 12–9


INFOR$–Internal Format Table Interface Routines<br />

Field Descriptions<br />

The fields in Figure 12–1 represent the following:<br />

FQL Length (in characters) of file qualifier or zero<br />

FNL Length (in characters) of file name or zero<br />

FCL Length (in characters) of F-cycle or zero<br />

RKL Length (in characters) of read key or zero<br />

WKL Length (in characters) of write key or zero<br />

IQF Implied qualifier flag<br />

ENL Length (in characters) of element name or zero<br />

EVL Length (in characters) of element version or zero<br />

ECL Length (in characters) of element cycle or zero<br />

CFN File continuation field number or zero<br />

ECC Element cycle signal character<br />

BEC Binary element cycle<br />

FQUAL Fieldata file qualifier<br />

FNAME Fieldata file name<br />

FCYC Fieldata F-cycle<br />

RKEY Fieldata read key<br />

WKEY Fieldata write key<br />

ENAME Fieldata element name<br />

EVER Fieldata element version<br />

ECYC Fieldata element cycle<br />

SELT does not clear ELT$. The calling program should test which field lengths of the<br />

first two words are nonzero. This determines which Fieldata fields contain meaningful<br />

information. If a Fieldata field is defined, the information it contains is left-justified and<br />

space-filled to one or two words.<br />

If the field selected by SELT$ contains a leading period, then the CFN field is set.<br />

The CFN field contains the number of the last field that did not contain a leading period.<br />

For example<br />

@PROCESSOR F.E1,E2,.E3<br />

12–10 7833 1733–004


INFOR$–Internal Format Table Interface Routines<br />

The element E3 is assumed to be in the same file as element E2. If the SELT$ routine is<br />

called to transfer the third field into the ELT$ table, then CFN is set to 2. Because there<br />

is no file name and no leading period in the second field, it is assumed that E2 is in file<br />

TPF$. Since TPF$ is an assumed file and not explicitly included on the processor call<br />

line, the field FNL is set to zero. In the following example:<br />

@PROCESSOR F.E1,.E2,.E3<br />

field two contains a leading period. The element E3 is still assumed to be in the same<br />

file as E2. By the same convention, element E2 is assumed to be in the same file as<br />

element E1. In this case, when SELT$ is called to transfer the third field of the<br />

processor call line, CFN is set to 1, FNL is set to 1, and the field FNAME in ELT$ is set to<br />

the Fieldata character string F.<br />

A leading asterisk sets the implied qualifier flag (IQF) to nonzero and the file qualifier<br />

length (FQL) to zero.<br />

SELT$ handles element cycles from the processor call line as follows:<br />

• If the element cycle field is not specified, the element cycle signal character (ECC)<br />

equals a Fieldata minus sign (-), and the Binary Element Cycle (BEC) equals zero.<br />

• When the element cycle field is specified, the numeric portion of the cycle is<br />

converted to binary and the result is placed in BEC.<br />

• If the cycle is neither numeric nor signed numeric or is greater than 63, the field ECC<br />

contains the Fieldata image E, which indicates an error. Normally, ECC contains 0,<br />

Fieldata +, or Fieldata - when the first character of the cycle is numeric, +, or -,<br />

respectively.<br />

No-find Return<br />

When a no-find return occurs, register A0 contains the address of the control word in the<br />

INFOR table that stopped the search. If this word is zero, the rest of the INFOR table is<br />

empty.<br />

12.3.4. DUSE$–Assign a USE Name to the File in ELT$<br />

The DUSE$ routine dynamically attaches an internal name to the file currently in the<br />

ELT$ table.<br />

The DUSE$ routine is called by the MASM procedure I$NFOR. This procedure can be<br />

used to generate the calling sequence for the relocatable version of the DUSE$ routine,<br />

the common bank version of the routine, or the common bank version of the routine<br />

using the Auto Switch calling sequence. Section 3 describes the advantages and<br />

disadvantages of using the different types of calls.<br />

Calling Format<br />

I$NFOR[,t] ‘DUSE$’[,use-name] [packet]<br />

return<br />

7833 1733–004 12–11


INFOR$–Internal Format Table Interface Routines<br />

Parameters<br />

t<br />

Type of call to DUSE$. This parameter is optional and may be omitted. If CB or A is<br />

specified, it must be enclosed by apostrophes.<br />

blank Call the relocatable version of DUSE$. This is the default if t is omitted.<br />

'CB' Call the common bank version of DUSE$.<br />

'A' Call the common bank version of DUSE$ using the Auto Switch<br />

method.<br />

DUSE$<br />

DUSE$ is the function code which specifies which of the INFOR$ routines the<br />

procedure I$NFOR should call. It must be enclosed by apostrophes.<br />

use-name<br />

packet<br />

The use name that is to be attached to the file currently in the ELT$ table. The use<br />

name may be from 1 to 12 characters selected from the set A through Z, 0 through<br />

9, including the special characters - and $. If given as a string, then this parameter<br />

must be surrounded by apostrophes on the procedure call. This parameter may also<br />

be given as the address of a two-word area that contains the name in Fieldata<br />

format, left-justified and space-filled. If the use-name parameter is not specified in<br />

the DUSE$ call, the use name is assumed to be contained by registers A0 and A1.<br />

Address of the 30-word packet required by the common bank version of INFOR$<br />

routine. This parameter is ignored unless parameter t is set to 'A' or 'CB'. If the<br />

common bank version of the INFOR$ routines is being called and this parameter is<br />

omitted, then the routine assumes the address has already been loaded into register<br />

A2 by the calling program.<br />

Return<br />

After the return, register A0 contains the status bits from CSF$ (see the Exec ER<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for information). The eight-word area, FILE$, contains<br />

the edited file name, left-justified, and space-filled). If a file name is not specified (FNL =<br />

0), TPF$ is assumed to be the default file.<br />

12–12 7833 1733–004


Section 13<br />

MFDSP$–Master File Directory Service<br />

Package<br />

MFDSP$ retrieves information about files from the master file directory (MFD). A copy<br />

of the MFD is needed before the MFDSP$ routine can be used. The MFD copy is<br />

produced by a call to ER MSCON$ (using the DGET$ or DGETP$ function). Once this<br />

copy of the MFD is in a mass storage file that is assigned to the calling program, the<br />

MFDSP$ routine can be used to retrieve the lead items, main items, and device area<br />

descriptor (DAD) tables of all the files in the MFD. A complete description of how the<br />

ER MSCON$ is used and what information is contained in lead items, main items, and<br />

DAD tables can be found in the Exec Installation and Configuration Guide.<br />

The copy of the MFD can also be obtained by initially calling MFDSP$ with function code<br />

10. MFDSP$ then does an ER MSCON$ DGET$ function to copy the MFD to a scratch<br />

file that MFDSP$ has assigned.<br />

The following subsections describe the packet needed by the MFDSP$ routine, as well<br />

as the MASM calling sequence.<br />

13.1. Packet<br />

The MFDSP$ routine requires that the calling program provide it with a packet. The first<br />

two words of the MFDSP$ packet must contain (in Fieldata LJSF) the internal file name<br />

of the file that holds the output from the ER MSCON$. This file must be assigned<br />

before the call to MFDSP$ can be made. Failure to have the file assigned results in an<br />

I/O error type 01, code 21, contingency 12.<br />

The MFDSP$ routine uses the remainder of the packet as scratch space. Since the<br />

routine does track-size double-buffered I/O, the packet must be large enough to hold two<br />

I/O packets, two track-size buffers, and additional space required by the MFDSP$ routine<br />

for its internal tables. In general, a packet of 4,400 words is an adequate starting size.<br />

Once the ER MSCON$ file is successfully initialized, the exact packet size required is<br />

returned in register A5. The packet length may have to be increased if a 02 error is<br />

returned.<br />

7833 1733–004 13–1


MFDSP$–Master File Directory Service Package<br />

13.2. Calling Sequence<br />

The MFDSP$ routine is called by the MASM procedure M$FDSP. M$FDSP is used to<br />

generate the calling sequence for the relocatable version, the common bank version, or<br />

the common bank version using the Auto Switch calling sequence. Section 3 describes<br />

the advantages and disadvantages of using the different types of calls.<br />

Calling Format<br />

M$FDSP[,t] pkt-length,pkt-addr,func-code,device-table-size<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

Type of call to MFDSP$. This parameter is optional and may be omitted. CB or A, if<br />

specified, must be enclosed by apostrophes.<br />

pkt-length<br />

blank Call the relocatable version of MFDSP$. This is the default if t is<br />

omitted.<br />

'CB' Call the common bank version of MFDSP$.<br />

'A' Call the common bank version of MFDSP$ using the Auto Switch<br />

method.<br />

The length of the packet provided by the calling program to the MFDSP$ routine.<br />

In general, a packet length of 4400 words is needed by MFDSP$. If this parameter<br />

is omitted, then the routine uses the value in H1 of register A0 as the packet length.<br />

The packet length parameter can be given as an actual number, a tag that has been<br />

equated to a number, or the address of a word that contains the packet length<br />

(see 13.4.).<br />

pkt-addr<br />

The address of the packet provided by the calling program to the MFDSP$ routine.<br />

The first two words of the packet must contain the internal file name (12 Fieldata<br />

characters, left-justified and space-filled format) of the file created by using the<br />

ER MSCON$. The rest of the packet is used by the MFDSP$ routine for I/O buffers<br />

and internal I/O packets and tables. If this parameter is omitted, then the routine<br />

uses the value in H2 of register A0 as the address of the packet.<br />

13–2 7833 1733–004


func-code<br />

MFDSP$–Master File Directory Service Package<br />

The function code may be given as an actual number, a tag that has been equated to<br />

an actual number, or the address of a word that contains the number. The first time<br />

the MFDSP$ routine is called, it must be called with a function code of zero or one.<br />

If the MFD file was created using the DGET$ function on the ER MSCON$, then use<br />

zero on the MFDSP$ call. If the MFD file was created using the DGET$P function on<br />

the ER MSCON$, then a function code of one must be used on the MFDSP$ call.<br />

If this parameter is omitted, the routine uses the value in H2 of register A1 as the<br />

function code. If device-table-size is specified as the fourth parameter then this<br />

parameter is required.<br />

The function codes for MFDSP$ are the following:<br />

0 Initialize for DGET$ file and return the address of the first lead item.<br />

1 Initialize for DGETP$ file and return the address of the first main item.<br />

2 Get next lead item (DGET$ file only).<br />

3 Get sector 1 of lead item (DGET$ file only).<br />

4 Get next main item.<br />

5 Get next sector of main item.<br />

6 Get first DAD table associated with the main item returned by function 4 or 5.<br />

7 Get next DAD table.<br />

8 Find item whose MFD address is in A2.<br />

9 Convert MFD address in A2 to DGET$ file relative address in A3.<br />

10 Get a ER MSCON$ (DGET$) copy of the MFD and initialize (function code 0)<br />

device-table-size<br />

If this parameter is omitted, the default maximum size of the device number table is<br />

1,000 words. The device table is a buffer built by MFDSP$ to contain a 1-word entry<br />

for each mass storage device configured on the system. Entries are located in the<br />

table according to the device number or LDAT index (see the Exec System Software<br />

Administration <strong>Reference</strong> <strong>Manual</strong> (subsection 2.2) for more information on the LDAT<br />

index). This means that if a device is numbered 100, its entry will occupy the 101 st<br />

word of the table (entries begin at the second word of the table). If this parameter is<br />

included, the ‘func-code’ parameter must also be included.<br />

The default maximum size of the device number table is 1,000 words. If your system<br />

includes devices numbered greater than 999, you can use this parameter to increase<br />

the table size to a maximum of 4,096 words. The requested word size of the table<br />

should be at least the highest device number plus 1. A device-table-size value of<br />

1000 or less will use the current table size of 1,000 words. The pkt-length<br />

(parameter 1) should also be increased when a larger device table size is requested<br />

by the fourth parameter. The device table size parameter is only used by functions<br />

that initialize the device table (functions 0, 1, and 10.) The value of this parameter is<br />

passed in H1 of register A1.<br />

7833 1733–004 13–3


MFDSP$–Master File Directory Service Package<br />

Returns<br />

On all returns, registers A0 through A3 are set as follows:<br />

A0<br />

A1<br />

A2<br />

A3<br />

A5<br />

Unchanged.<br />

Main storage address of requested item or zero if the requested item could not be<br />

found.<br />

Item type bits (rightmost bit is bit 35):<br />

Bit 35 Lead item<br />

Bit 34 Sector 0 or first item<br />

Bit 33 Sector 1 or extension or continuation item<br />

Bit 31 Main item<br />

Bit 29 DAD table<br />

Bits 33 and 34 may be set with any of the other bits.<br />

For example, if A2 = 0102, then the item returned is the first DAD table.<br />

Error code (if error return is taken). Zero if the item is not found.<br />

MFD address of requested item or zero if the requested item could not be obtained.<br />

Amount of D-bank required for the packet supplied to MFDSP$.<br />

13–4 7833 1733–004


13.3. Error Conditions<br />

MFDSP$–Master File Directory Service Package<br />

On error return, registers A4 and A5 sometimes contain additional information. MFDSP$<br />

error codes (returned in register A2) are as follows:<br />

01<br />

02<br />

03<br />

04<br />

05<br />

06<br />

Function out of range.<br />

Buffer too small.<br />

A4 = one of the following values, indicating the type of buffer size error:<br />

1<br />

2<br />

3<br />

Buffer smaller than minimum scratch space required to do any function.<br />

This code is only returned if the buffer is smaller than 200 words.<br />

Buffer is too small to complete initialization of the DGET$ or DGETP$ file.<br />

Buffer is large enough to complete initialization of the file but is not large<br />

enough to do double-buffered I/O on the file.<br />

A5 = Amount of buffer space required.<br />

In all cases, the calling program may obtain the required amount of buffer space and<br />

reinitialize the package.<br />

Illogical function sequence; for example, a request was made to obtain a main item<br />

extension sector when the preceding request was not for a main item.<br />

Bad link to lead item sector 1; A3 = MFD address in error.<br />

Bad link from lead item to main item; A3 = MFD address in error.<br />

Main item does not have MBIT set.<br />

7833 1733–004 13–5


MFDSP$–Master File Directory Service Package<br />

07<br />

010<br />

011<br />

012<br />

013<br />

014<br />

015<br />

016<br />

017<br />

020<br />

021<br />

Main item does not link back to lead item.<br />

Name in main item not same as name in lead item.<br />

Calculated F-cycle does not match F-cycle in main item.<br />

Bad link to main item extension; A3 = MFD address in error.<br />

Main extension does not link back to main item.<br />

Name in main item extension not same as name in lead item.<br />

Main extension has bad sentinel.<br />

Bad link to first DAD; A3 = MFD address in error.<br />

Bad link from DAD to DAD; A3 = MFD address in error.<br />

Undefined MFD address passed by caller.<br />

MFD address conversion error. A DAS was found with a track address in word zero<br />

that was invalid.<br />

A3<br />

MFD address in error.<br />

13–6 7833 1733–004


022<br />

023<br />

024<br />

025<br />

026<br />

027<br />

A5<br />

041 LDAT index in range but not defined.<br />

042 LDAT index too large.<br />

043 Track offset into unit too large.<br />

044 Track not allocated.<br />

MFDSP$–Master File Directory Service Package<br />

This is a fatal error. Reinitialization of the package is not possible.<br />

I/O error reading sector zero of DGET$ file.<br />

A4 Address of I/O packet.<br />

A5 I/O status code.<br />

I/O error reading first directory track.<br />

A4 Address of I/O packet.<br />

A5 I/O status code.<br />

More than one unit with same LDAT. This is a fatal error in the structure of the<br />

MFD. Reinitialization of the package is not possible.<br />

DAS in unallocated track. This is a fatal error in the structure of the MFD.<br />

Reinitialization of the package is not possible.<br />

Bad I/O status reading DAS.<br />

A4 Address of I/O packet.<br />

A5 I/O status code.<br />

Garbage lead item. A lead item was found that contained invalid links to all main<br />

items.<br />

7833 1733–004 13–7


MFDSP$–Master File Directory Service Package<br />

030<br />

031<br />

032<br />

033<br />

034<br />

035<br />

070<br />

071<br />

077<br />

Error in structure of MFD. This is a fatal error in the structure of the MFD.<br />

Reinitialization of the package is not possible.<br />

Too many units configured. Either there is an error in the MFD or the number of<br />

different units configured is greater than the parameter MAXUNT. MAXUNT is set<br />

to 1,000 in the released version.<br />

Bad main item in DGETP$ file. A main item from a DGETP$ file was found to have<br />

an invalid link to the first DAD table or the first DAD table did not link back to the<br />

main item.<br />

Error return from ER MSCON$ (status word in register A4). See the Exec<br />

Administration <strong>Reference</strong> <strong>Manual</strong>.<br />

Error return from GETPSF$ (status in register A4).<br />

A device table size of more than 4,096 words was requested by the fourth call<br />

parameter “device-table-size.”<br />

Function undefined.<br />

Internal error.<br />

I/O error.<br />

A4 Address of I/O packet.<br />

A5 I/O status code.<br />

13–8 7833 1733–004


13.4. Examples<br />

MFDSP$–Master File Directory Service Package<br />

The following MASM instructions illustrate how the M$FDSP can be used:<br />

$INCLUDE ‘MAXR$/’<br />

$ASCII<br />

$(2)<br />

FNCT $EQU 0<br />

VALUE + 0<br />

BUFFER $RES 4400<br />

BUFFLN $EQU $-BUFFER<br />

$(1)<br />

START .<br />

DL A0,($CFS(‘MFD ‘))<br />

DS A0,BUFFER<br />

M$FDSP,‘CB’ BUFFLN,BUFFER,0<br />

J MFDERR<br />

M$FDSP,‘CB’ BUFFLN,BUFFER,FNCT<br />

J MFDERR<br />

LXI,U X11,0<br />

LXI,U A0,BUFFLN<br />

LXM,U A0,BUFFER<br />

M$FDSP ,, VALUE<br />

J MFDERR<br />

J DONE<br />

MFDERR .<br />

L$SNAP ‘MFDERR’,2,0,0<br />

DONE .<br />

ER EXIT$<br />

$END START<br />

The structure of the MFD is described in the Exec Administration <strong>Reference</strong> <strong>Manual</strong>.<br />

Every filename has a lead item entry in the MFD. For every F-cycle of that particular<br />

filename, a main item entry exists. The lead item contains links to all the main items,<br />

and it can be up to two sectors, sector 0 and sector 1. If there are more main items than<br />

sector 0 can hold links to, a sector 1 of the lead item will contain the links to the rest of<br />

the main items. To access all possible main items in the MFD, you must use the<br />

following algorithm:<br />

Call MFDSP$ specifying function 0 to initialize and get<br />

the first lead item.<br />

GETNEXTMAIN:<br />

Call MFDSP$ specifying function 4, (Get-Next-Main-Item),<br />

and continue calling Get-Next-Main-Item until a<br />

No-Find condition (A1=0) occurs.<br />

Call Get-Sector-1-of-Lead-Item (MFDSP$ function 3).<br />

IF a No-Find condition (A1=0) occurs, jump to GETNEXTLEAD.<br />

Call Get-Next-Main-Item and continue to call it until a<br />

No-Find condition occurs (A1=0).<br />

GETNEXTLEAD:<br />

Call Get-Next-Lead-Item (MFDSP$ function 2).<br />

IF a No-Find condition (A1=0) occurs, exit the program,<br />

OTHERWISE jump to GETNEXTMAIN.<br />

7833 1733–004 13–9


MFDSP$–Master File Directory Service Package<br />

A sample MASM program was developed which performs the preceding algorithm. It is<br />

designed to be called only once.<br />

.<br />

. A program to access all the main items in the Master File Directory<br />

.<br />

INCLUDE ‘MAXR$’<br />

$(1)<br />

START* .<br />

LA,U A0,MFDPKT . Call ER MSCON$ to acquire a<br />

ER MSCON$ . copy of the directory<br />

SA A0,STATWORD .<br />

TZ,S3 STATWORD . Was MSCON$ erroneous?<br />

J ERROR . YES, exit with error<br />

DIROK .<br />

LA A0,(4400,DSPPKT) . Call MFDSP$ function 0 to<br />

LA,U A1,0 . initialize for DGET$ file<br />

LMJ X11,MFDSP$ . and return the address of<br />

. of the first lead item.<br />

J ERROR . A 0,X11 return means error.<br />

SZ A4 . Set a flag showing we have<br />

. not gotten lead item sector 1.<br />

NXTMAIN .<br />

LA A0,(4400,DSPPKT) . Call MFDSP$ function 4<br />

LA,U A1,4 . (Get Next Main Item).<br />

LMJ X11,MFDSP$ .<br />

J ERROR . A 0,X11 return means error<br />

JZ A1,NOSNAP . IF A1=0, no Main Item found<br />

SA A0,SNAPPKT+2 . ELSE, print out sector 0 of<br />

SA,H2 A1,SNAPPKT+1 . the main item<br />

LA,U A0,SNAPPKT .<br />

ER SNAP$ .<br />

NOSNAP .<br />

TZ A1 . Was a Main Item found?<br />

J NXTMAIN . Yes, get the next one.<br />

TNE,U A4,1 . Have we already gotten<br />

. sector 1 of the lead item?<br />

J NEXTLEAD . YES, get the next lead item<br />

LA,U A4,1 . NO, set the flag to show<br />

. we’re getting sector 1 now.<br />

LA A0,(4400,DSPPKT) .<br />

LA,U A1,3 . Get sector 1 of lead item.<br />

LMJ X11,MFDSP$ .<br />

J ERROR . A 0,X11 return means error<br />

JZ A1,NOSNAP3 . IF A1=0, no find occurred.<br />

SA A0,SNAPPKT3+2 . ELSE, print out sector 1 of<br />

SA,H2 A1,SNAPPKT3+1 . the current lead item.<br />

LA,U A0,SNAPPKT3 .<br />

ER SNAP$ .<br />

13–10 7833 1733–004


MFDSP$–Master File Directory Service Package<br />

NOSNAP3 .<br />

TZ A1 . Did we find a sector 1?<br />

J NXTMAIN . YES, get more main items<br />

NEXTLEAD .<br />

SZ A4 . Set the flag showing we have<br />

. not gotten lead item sect 1.<br />

LA A0,(4400,DSPPKT) . (We’re getting the next lead<br />

LA,U A1,2 . item now.)<br />

LMJ X11,MFDSP$ .<br />

J ERROR . A 0,X11 return means error<br />

JZ A1,EXIT . IF A1=0, no find occurred.<br />

SA A0,SNAPPKT2+2 . ELSE print out sector 0 of<br />

SA,H2 A1,SNAPPKT2+1 . the lead item.<br />

LA,U A0,SNAPPKT2 .<br />

ER SNAP$ .<br />

J NXTMAIN . Get the next main item.<br />

ERROR .<br />

L$SNAP ‘ERROR’,2 . An error occurred. ABORT.<br />

ER EABT$ .<br />

EXIT .<br />

er exit$ . exit the program.<br />

$(0) .<br />

SNAPPKT + ‘MAIN’ . The Main Item SNAP packet<br />

+ 0200034000000 . Snap A-registers, 034 words,<br />

+ 0 . start address gets filled in<br />

. in the code.<br />

SNAPPKT2 + ‘LEAD0’ . The Lead Item sector 0 SNAP<br />

+ 0200034000000 . packet<br />

+ 0 .<br />

SNAPPKT3 + ‘LEAD1’ . The Lead Item sector 1 SNAP<br />

+ 0200034000000 . packet<br />

+ 0 .<br />

STATWORD $RES 1 .<br />

MFDPKT + 015 . The packet needed for<br />

+ ‘TDIR$’ . calling ER MSCON$<br />

+ 900 .<br />

+ MFDBUF1,MFDBUF2 .<br />

+ 0 .<br />

MFDBUF1 $RES 1792 .<br />

MFDBUF2 $RES 1792 .<br />

DSPPKT + ‘TDIR$’ . The packet needed for<br />

$RES 4398 . calling MFDSP$.<br />

$END START .<br />

7833 1733–004 13–11


MFDSP$–Master File Directory Service Package<br />

13–12 7833 1733–004


Section 14<br />

PREPRM, PREPRO, PREPF$, and<br />

POSTPR$<br />

PREPRM, PREPRO, and PREPF$ are preprocessor routines; POSTPR$ is a<br />

postprocessor routine. The preprocessor routines assign input and output files to a<br />

processor. The postprocessor routine frees files that were assigned by a preprocessor<br />

routine.<br />

14.1. PREPRO, PREPRM–Preprocessor Routines<br />

PREPRO is designed for use by processors that require three fields on the processor call<br />

statement. The processor calling PREPRO can use up to the maximum 63 fields but<br />

PREPRO will only process the first three fields. Some of the OS 2200 processors that<br />

use PREPRO are ACOB, Collector (MAP), FTN, LINK, and MASM.<br />

PREPRM is designed for use by processors that require two fields on the processor call<br />

statement. The processor calling PREPRM can use up to the maximum 63 fields but<br />

PREPRM will only process the first two fields. Two of the OS 2200 processors that use<br />

PREPRM are ELT and PDP.<br />

See the ECL and FURPUR <strong>Reference</strong> <strong>Manual</strong> for a complete description of the processor<br />

call statement. The general format of the processor call statement is<br />

@[label:]processor[,options] field-1,field-2,field-3,...,field-n<br />

PREPRO dynamically attaches internal filenames to the filenames specified in the first<br />

three fields as follows: SI$$ is attached to field-1, RO$$ is attached to field-2, and SO$$<br />

is attached to field-3. Therefore, field-1 is commonly referred to by the mnemonic SI,<br />

field-2 as RO, and field-3 as SO.<br />

field-1 (SI) is expected to contain the symbolic input to the processor. PREPRO checks<br />

that the element specified is typed as symbolic (element type 01).<br />

field-2 (RO) is expected to contain an output element and may be used for executable,<br />

object module, omnibus, relocatable, or symbolic output. If the Relocatable Output<br />

Routine (ROR) will be used, then field-2 (RO) specifies the relocatable output element.<br />

field-3 (SO) is typically used for the updated symbolic output element if corrections are<br />

applied to the input symbolic element in field-1 (SI). If the Symbolic Input/Output<br />

Routine (SIR$) will be used then field-3 (SO) specifies the symbolic output element.<br />

7833 1733–004 14–1


PREPRM, PREPRO, PREPF$, and POSTPR$<br />

PREPRM dynamically attaches internal filenames to the filenames specified in the first<br />

two fields as follows: SI$$ is attached to field-1 and SO$$ is attached to field-2.<br />

field-1 (SI) is expected to contain the symbolic input to the processor. PREPRM checks<br />

that the element specified is typed as symbolic (element type 01).<br />

field-2 (SO) is typically used for the updated symbolic output element if corrections have<br />

been applied to the input symbolic element in field-1 (SI). This would apply if the routine<br />

SIR$ will be used. However, field-2 (SO) may be used for other types of output<br />

elements.<br />

The mnemonics SI, RO, and SO appear in error messages output by PREPRO and<br />

PREPRM. They refer to the first three fields on the processor call statement as follows:<br />

SI field-1<br />

RO field-2<br />

SO field-2 if PREPRM is used; field-3 if PREPRO is used<br />

14.1.1. PREPRO–Preprocessor Routine<br />

PREPRO reads the processor call statement in internal format (INFOR) (see Section 12),<br />

standardizes its form in PARTBL (see Figure 14-1), and dynamically assigns the<br />

necessary files. PREPRO obtains the “next write location” for program files and, for<br />

tape files, verifies that the source input element exists.<br />

Initial Conditions<br />

The processor must call PREPRO before it executes any read command such as<br />

ER SYMB$ (READ$ function), ER AREAD$, or ER READ$.<br />

The parameter table PARTBL must be externally defined and at least 40 words long. It<br />

also should be zero-filled.<br />

Calling Sequence<br />

LMJ X11,PREPRO$<br />

error return<br />

normal return<br />

Error Return<br />

The error return is taken under the following conditions:<br />

I/O error occurs (A0 = 0)<br />

error when reading INFOR (A0 ≠ 0)<br />

tape positioned improperly (A0 ≠ 0)<br />

file does not exist (A0 ≠ 0)<br />

file is not a program file (A0 ≠ 0)<br />

14–2 7833 1733–004


PREPRM, PREPRO, PREPF$, and POSTPR$<br />

The PARTBL that the calling program provides is filled with the data that is necessary to<br />

process the files. The input/output files are assigned as follows:<br />

SI assigned<br />

RO assigned exclusively<br />

SO assigned exclusively<br />

If SI is the same file as RO or SO, it is assigned exclusively.<br />

14.1.2. PREPRM–Preprocessor Routine<br />

PREPRM generates the source input and source output fields of PARTBL<br />

(see Figure 14-1). It performs dynamic assigns and program file searches on the source<br />

input and source output files.<br />

Initial Condition<br />

PARTBL must be externally defined and 27 words long (or 40 words long if relocatable<br />

output field is needed). It should be zero-filled.<br />

Calling Sequence<br />

LMJ X11,PREPRM$<br />

error return<br />

normal return<br />

The information on the processor call statement is transferred to PARTBL (see Figure<br />

14–1).<br />

The input/output files are assigned as follows:<br />

Symbolic input assigned<br />

Symbolic output assigned exclusively<br />

If the symbolic input file is the same file as the symbolic output file, the symbolic input<br />

file is assigned exclusively.<br />

On error return, an error message is printed.<br />

The PREPRO and PREPRM automatically fill PARTBL fields when called. The fields are<br />

filled with data needed by the SIR$, ROR, SOR, and POSTPR$ routines of <strong>SYSLIB</strong>.<br />

7833 1733–004 14–3


PREPRM, PREPRO, PREPF$, and POSTPR$<br />

Figure 14–1. PARTBL Table Format<br />

14–4 7833 1733–004


14.1.3. PARTBL Description<br />

PREPRM, PREPRO, PREPF$, and POSTPR$<br />

PARTBL is generated by the <strong>SYSLIB</strong> preprocessing routines (PREPRO, PREPRM, or<br />

PREPF) and provides file information to SIR$, ROR, SOR, and POSTPR$. This<br />

information includes the file/element name, cycle, size, and location of elements. All file,<br />

element, and version names are left-justified and space-filled.<br />

The internal filenames are use-names that have been dynamically attached to the<br />

external filenames on the processor call statement by the PREPRM, PREPRO, and<br />

PREPF$ routines. The internal names in PARTBL can be as follows:<br />

Field Processor Call<br />

PREPRO PREPRM PREPF$<br />

Field 1 SI$$ SI$$ SI$<br />

Field 2 R0$$ SO$$ SO$<br />

Field 3 SO$$<br />

The mnemonics refer to<br />

SI symbolic input<br />

SO symbolic output<br />

RO resultant output<br />

The default file name is TPF$. NAME$ is the default element name.<br />

Word 0<br />

input file type<br />

0 Input from runstream<br />

050 Program file<br />

076 Tape file<br />

options<br />

Words 3–12<br />

Option letters are A through Z left to right; for example, if the Z option is<br />

specified, bit 35 is set to 1.<br />

Contain the symbolic input element table item in the program file table of contents.<br />

7833 1733–004 14–5


PREPRM, PREPRO, PREPF$, and POSTPR$<br />

Word 13<br />

file information<br />

Contains indicators that the routine POSTPR$ uses to restore program files to<br />

their original assignment state.<br />

S1 Source input<br />

S2 Source output<br />

S3 Relocatable output<br />

0 No action<br />

1 @FREE,A remove attached name (SI$, SO$, RO$)<br />

2 @FREE,AX remove attached name and release exclusive use<br />

3 @FREE,AR remove attached name and free file<br />

010 File is read inhibited<br />

020 File is tape<br />

040 Write permission denied<br />

ITI–input termination indicator<br />

Contains the SIR$ input termination indicator for purposes of processor<br />

reusability. The possible values are<br />

0<br />

1<br />

2<br />

Reuse of the processor is possible. (Input terminated by call to CLOSR$, or<br />

@EOF image, end of @ADD,E file, INFOR CLIST image, or transparent<br />

control image.)<br />

End of file has been encountered. (Symbiont read operation returned with<br />

bit 0 set in register A0.)<br />

requested cycle<br />

@ENDX has been encountered.<br />

Contains source input element cycle requested. If none requested, the latest<br />

cycle is used.<br />

Words 16–25<br />

Contain the symbolic output element table item.<br />

14–6 7833 1733–004


Words 27–39<br />

May also be used for source output, that is, with SOR.<br />

Words 29–38<br />

Contain the relocatable element table item.<br />

14.1.4. Reusable Processor Construction<br />

PREPRM, PREPRO, PREPF$, and POSTPR$<br />

Initial program load operations are expensive relative to swapping. A mechanism is<br />

provided that allows a program to make itself reusable, thereby avoiding the need to<br />

reload itself. This applies to programs called by processor call statements but not by<br />

@XQT. If the processor in question makes use of the standard processor interface<br />

routines (PREPRO, PREPRM, POSTPR$, ROR, SOR, SIR$), implementing reusability is<br />

not a major task. The following describes the appropriate steps.<br />

1. Register the processor name with INFOR CLIST (ER CLIST$), either ASCII or<br />

Fieldata. Use a type 0 list, because an unknown control statement terminates CLIST<br />

mode. See the Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

2. Become self-initializing or self-reinitializing. This means that any data areas that are<br />

expected to contain particular values at the beginning of the program must be<br />

initialized by a particular instruction sequence. Do not rely on static data initialization.<br />

Do this by explicitly setting all initialized variables to their initial value or by reloading<br />

the main segment. The former method is recommended unless the number of<br />

variables is excessive.<br />

3. Check for potential reusability as indicated in PARTBL by SIR$ (S4 of PARTBL+13;<br />

see Figure 14–1); then call REPRO$ or REPRM$ to read the next INFOR, if any;<br />

reinitialize or terminate depending on which return is given by REPRO$/REPRM$.<br />

This is done with the following steps:<br />

a. If S4 of PARTBL+13 > 0, call POSTPR$, then quit.<br />

b. Zero INFOR$ (see Section 12), then call REPRO$ or REPRM$, setting A0 as<br />

desired.<br />

c. If absolute-eof return, call POSTPR$, then quit.<br />

d. If wrong CLIST value, take action as defined for the particular processor in<br />

question.<br />

e. If error return, treat same as error return from PREPRO or PREPRM.<br />

f. If normal return, reinitialize the processor (and SIR$, if used, by storing 0 in<br />

SIRP2$); begin new processing operation (compilation, assembly, and so on).<br />

7833 1733–004 14–7


PREPRM, PREPRO, PREPF$, and POSTPR$<br />

14.1.4.1. REPRO$–Reusable Processor Preprocessor Routine<br />

REPRO$ reads INFOR from the INFOR CLIST processor call statement. INFOR$ must<br />

be set to zero. REPRO$ also performs some of the same functions as PREPRO.<br />

Initial Conditions<br />

The calling program must establish an INFOR CLIST. On completing SIR$, S4 of<br />

PARTBL+13 must be zero.<br />

PARTBL must be externally defined and at least 40 words long.<br />

Calling Sequence<br />

LA A0,expected-CLIST-index-or-zero<br />

LMJ X11,REPRO$<br />

absolute-eof return<br />

wrong-CLIST-index return<br />

error return<br />

normal return<br />

Returns<br />

error<br />

normal<br />

Identical to those for PREPRO$.<br />

absolute-eof<br />

Indicates that an end-of-file condition has been encountered that cannot be<br />

bypassed; that is, a nontransparent control statement or @ENDX was encountered.<br />

In this case, the processor cannot reuse itself and must terminate.<br />

wrong-CLIST-index<br />

The wrong-CLIST-index return is optional for processors that have more than one<br />

item in their INFOR CLIST and only want to analyze one specific command<br />

automatically; the command is specified by its CLIST index given in A0 prior to<br />

calling REPRO$. This return never occurs if A0 is zero on entry to REPRO$.<br />

After the wrong-CLIST-index return, X11 points to a reentry location you want to<br />

continue with the preprocessor routine. (Note that the CLIST index encountered is<br />

found in S3 of INFOR$+1.) Use the following instructions:<br />

LMJ X11,0,X11<br />

error return<br />

normal return<br />

The two returns are the same as for PREPRO$.<br />

14–8 7833 1733–004


PREPRM, PREPRO, PREPF$, and POSTPR$<br />

14.1.4.2. REPRM$–Reusable Processor Preprocessor Routine<br />

REPRM$ reads INFOR from the INFOR CLIST processor call statement; INFOR$ must<br />

be set to zero. The other functions of REPRM$ are the same as for PREPRM, except<br />

the reentry feature of REPRM.<br />

Initial Conditions<br />

The calling program must establish an INFOR CLIST. On completing SIR$, S4 of<br />

PARTBL+13 must be zero.<br />

PARTBL must be externally defined and at least 27 words long.<br />

Calling Sequence<br />

LA A0,expected-CLIST-index-or-zero<br />

LMJ X11,REPRM$<br />

absolute-eof return<br />

wrong-CLIST-index return<br />

error return<br />

normal return<br />

Returns<br />

error<br />

normal<br />

Identical to those for PREPRM$.<br />

absolute-eof<br />

Indicates that an EOF condition has been encountered that cannot be bypassed; that<br />

is, a nontransparent control statement or @ENDX was encountered. In that case,<br />

the processor cannot reuse itself and must terminate.<br />

wrong-CLIST-index<br />

Is optional for processors that have more than one item in their INFOR CLIST and<br />

only need to analyze one specific command automatically; this is specified by its<br />

CLIST index given in register A0 prior to calling REPRM$. This return is never taken<br />

if register A0 is zero on entry to REPRM$.<br />

After the wrong-CLIST-index return, X11 points to a reentry location when the<br />

preprocessor routine continues. (Note that the CLIST index is found in S3 of<br />

INFOR$+1.)<br />

Use the following instructions to reenter REPRM$:<br />

LMJ X11,0,X11<br />

error return<br />

normal return<br />

The two returns are the same as PREPRM$.<br />

7833 1733–004 14–9


PREPRM, PREPRO, PREPF$, and POSTPR$<br />

14.1.5. FLDGET–Processor Field Retrieval<br />

The FLDGET routine retrieves individual fields from the processor call statement that<br />

PREPRO or PREPRM do not process, such as field number 4 or higher if PREPRO is<br />

being used and field number 3 or higher if PREPRM is being used.<br />

Initial Conditions<br />

FLDGETO$ and FLDGETM$ require PARTBL as defined for PREPRO and PREPRM,<br />

respectively.<br />

Calling Sequence<br />

F66618 $FORM 6,6,6,18 . MASM form directive<br />

F2466 $FORM 24,6,6<br />

or<br />

Parameters<br />

Register A1<br />

S5 of A1<br />

ft<br />

S6 of A1<br />

fn<br />

L A1,(F2466 0,ft,fn)<br />

L A0,(F66618 0,n,m,j)<br />

LMJ X11,FLDGETO$ (if using PREPRO$)<br />

LMJ X11,FLDGETM$ (if using PREPRM$)<br />

error return<br />

normal return<br />

field type of the field to be retrieved (see Field Type in Appendix G)<br />

field number of the field to be retrieved (see Field Number in Appendix G)<br />

14–10 7833 1733–004


Register A0<br />

S2 of A0<br />

S3 of A0<br />

n<br />

H2 of A0<br />

m<br />

j<br />

control bits<br />

Bit 11 (rightmost bit in S2 of A0)<br />

Bit 10<br />

Bit 9<br />

if set, field will be used for output<br />

if not set, field will be used for input<br />

if set, do not allow tape for input<br />

if not set, allow tape for input<br />

PREPRM, PREPRO, PREPF$, and POSTPR$<br />

if set, FLDGET does not print an error message when the specified field<br />

cannot be found<br />

if set, FLDGET prints all error messages<br />

type of element (1 through 7); if field is intended to name an element in a<br />

program file. Add 070 to element type if field is intended to name a file or<br />

an element in a program file. Use 070 if field is intended to name a file only.<br />

address of 13 word data area<br />

Error Return<br />

The error return is taken when<br />

• The file cannot be assigned correctly.<br />

• The input element cannot be found.<br />

• A field is incorrectly coded.<br />

• The specified field cannot be found. (A0 contains the same information SELT$<br />

returned in A0 on a no find return.)<br />

7833 1733–004 14–11


PREPRM, PREPRO, PREPF$, and POSTPR$<br />

The information pertaining to the requested field is transferred from the INFOR table to<br />

the 13-word data area specified by j. FLDGET assigns the files on the processor call line<br />

if necessary. If elements are designated for input, then FLDGET verifies the existence of<br />

the element. An internal file name of the form "Fxxyy$" is attached to each file, where xx<br />

is the field type and yy is the field number. TPF$ is the default file.<br />

The processor can request either a file or an element by adding 070 to the element type.<br />

In other words, 077 in field m indicates an omnibus element or a file. The request for an<br />

element has precedence over a request for a file.<br />

The following describes how FLDGET uses the control bits of parameter n in register A0.<br />

When bit 11 of parameter n is set (in other words, field is for output), FLDGET:<br />

• Assigns file exclusively<br />

• Does not allow tape files<br />

• Stores the element name, version, and type in the 13-word data area<br />

When bit 11 of parameter n is not set (in other words, field is for input), FLDGET<br />

• Allows tape files (depending on bit 10 of parameter n)<br />

• Stores the equipment code in S4 of the first word of the 13-word data area<br />

• Does an ER PFS$ on the supplied information<br />

• Checks element cycling; relative cycling is allowed<br />

When bit 9 of parameter n is set, error message printing is suppressed and the first<br />

word of the 13-word data area is set to negative if the specified field cannot be found.<br />

All other error messages are printed.<br />

14.2. PREPF$–Preprocessor Routine<br />

PREPF$ generates the source input and source output fields of PARTBL (see<br />

Figure 14–1). PREPF$ also performs dynamic assigns of source input and output files if<br />

they are not already assigned. This routine is intended for processors that use files<br />

rather than elements. The input or output file may be a tape file, a temporary file, or a<br />

cataloged file.<br />

PREPF$ is for processors that require two fields on the processor call statement and use<br />

files instead of elements. The files can be tape files, temporary files, or cataloged files.<br />

The processor calling PREPF$ can have a maximum of 63 fields, but PREPF$ will only<br />

process the first two fields. The two fields are processed as the source input file and/or<br />

the source output file depending on the option field on the processor call statement.<br />

PREPF$ performs dynamic assigns of the files if they are not aleady assigned, and<br />

attaches internal file names as follows:<br />

$SI is attached to the source input file.<br />

$SO is attached to the source output file.<br />

14–12 7833 1733–004


PREPRM, PREPRO, PREPF$, and POSTPR$<br />

PREPF$ generates the source input and source output fields of PARTBL (see Figure<br />

14–1).<br />

Initial Condition<br />

PARTBL must be externally defined, and at least 27 decimal words in length, and should<br />

be zero-filled.<br />

Calling Sequence<br />

LMJ X11,PREPF$<br />

error return<br />

normal return<br />

PREPF$ transfers information from the source input and source output parameters of<br />

the processor call line to PARTBL. The options specified on the processor call statement<br />

control how the information is placed in PARTBL. The options and associated results are<br />

as follows:<br />

• No options<br />

− If only the SI field is given, it is assumed to be the output file.<br />

− If only the SO field is given, an error message is printed and the error return is<br />

taken.<br />

− If both SI and SO fields are given, the files are assigned.<br />

− If the SI and SO fields are not given, the PARTBL internal filename for SI and SO<br />

is set to 12 fieldata space characters, and a normal return to the user is taken.<br />

• I option<br />

− SI field is assumed to be the output file.<br />

− If the SO field is given, an error message is printed and the error return is taken.<br />

− If the SI and SO fields are not given, the PARTBL internal file name for SI and SO<br />

is set to 12 Fieldata space characters, and a normal return to the user is taken.<br />

• U option<br />

− If the SI field is not given, an error message is printed and the error return taken.<br />

− If the SO field is given, an error message is printed and the error return taken.<br />

− The U option implies that the next higher F-cycle of the SI file is to be produced.<br />

The SI file must be a cataloged or temporary file. The SI (+1) file must be<br />

assigned to the run. The name specified in the SI field cannot be a use name.<br />

The error return is taken if PREPF$ receives a nonzero status code from a call to ER<br />

CSF$.<br />

7833 1733–004 14–13


PREPRM, PREPRO, PREPF$, and POSTPR$<br />

14.3. POSTPR$–Postprocessor Routine<br />

POSTPR$ removes all changes in the assignment status of a file that PREPRO,<br />

PREPRM, or PREPF$ made.<br />

Calling Sequence<br />

LMJ X11,POSTPR$<br />

error return<br />

normal return<br />

All files specified on the processor call statement are restored to the status they had<br />

before the processor call.<br />

The error return is taken if POSTPR$ receives a nonzero status code from a call to ER<br />

CSF$.<br />

14.4. FLDREL$–Field Release<br />

FLDREL$ removes changes in the assignment of program files that were made by<br />

FLDGETO$ or FLDGETM$.<br />

Calling Sequence<br />

L,U A0,address<br />

LMJ X11,FLDREL$<br />

error return<br />

normal return<br />

where address is the address of the data area given to FLDGET$.<br />

Using the information saved in the first three words of the data area pointed to by<br />

address, the file is restored to the state it was in before FLDGET$ was called.<br />

The error return is taken if the free returns a negative status.<br />

14–14 7833 1733–004


Section 15<br />

ROR, ROR$–Relocatable Output Routine<br />

The Relocatable Output Routine produces a relocatable element that is used for input to<br />

the Collector. The relocatable element is produced from relocatable items the language<br />

processors generate.<br />

The Relocatable Output Routine contains user interfaces SROR$, ROR$, EROR$, and<br />

TBLWR$. The following subsections describe these interfaces. Do not call the<br />

Relocatable Output Routine from a minor register set activity.<br />

If the external buffer version of ROR (ROR$) is used, ($EB entry points) then the $EB<br />

entry points must be used for all calls to ROR. These entry points are: SROR$EB,<br />

ROR$EB, EROR$EB, and TBLWR$EB.<br />

15.1. SROR$, SROR$EB–Start Relocatable Output<br />

Routine<br />

SROR$ initializes ROR prior to writing any relocatable text words.<br />

Calling Sequence<br />

L,U A0,K-bit limit<br />

LMJ X11,SROR$<br />

error return<br />

normal return<br />

Parameters<br />

K-bit limit<br />

The number of bits required to contain either the largest control counter or the<br />

number of undefined symbols for the relocation, whichever is larger.<br />

SROR$ saves the K-bit limit for the relocatable element and establishes the program file<br />

write location for the element via ER PFWL$. (See the Exec ER <strong>Programming</strong> <strong>Reference</strong><br />

<strong>Manual</strong>.) SROR$ adjusts the output buffer to minimize read-before-write operations,<br />

if possible.<br />

7833 1733–004 15–1


ROR, ROR$–Relocatable Output Routine<br />

Error Return<br />

The error return occurs when a nonzero status code is encountered in register A2.<br />

Register A2 contains the status code from ER PFWL$. (See the Exec ER <strong>Programming</strong><br />

<strong>Reference</strong> <strong>Manual</strong>.)<br />

The calling parameters for SROR$EB differ from SROR$ by the addition of a parameter<br />

that defines the external buffer to be used by ROR$. The length and address of the<br />

buffer are provided by the caller in H1 and H2 of register A1, respectively. All other<br />

parameters for SROR$EB are unchanged. A buffer length of at least 1792 words<br />

(1 track) is recommended.<br />

Calling Sequence (External Buffer)<br />

L,U A0,K-bit limit<br />

L A1,(length-of-buffer,address-of-buffer)<br />

LMJ X11,SROR$EB<br />

error return<br />

normal return<br />

Parameters<br />

length-of-buffer<br />

The number of words in buffer. Must be a multiple of 112 words (4 sectors).<br />

A minimum buffer length of 1792 words (1 track) is recommended.<br />

address-of-buffer<br />

Address of the buffer in caller's data area.<br />

15.2. ROR$, ROR$EB–Generation of Relocatable<br />

Output<br />

ROR$ formats relocatable items and outputs text to the relocatable element.<br />

Calling Sequence<br />

L,U A0,address-of-item<br />

LMJ X11,ROR$ (or ROR$EB)<br />

error return<br />

normal return<br />

Error Return<br />

The error return is taken when<br />

• An I/O error occurs; A1 will contain the status.<br />

• An internal inconsistency occurred in ROR; A1 will be zero.<br />

15–2 7833 1733–004


Item Description<br />

ROR, ROR$–Relocatable Output Routine<br />

ROR is called for every text word that will be inserted into the relocatable element.<br />

(Examples of text words are the instruction or data word.) For each call, the calling<br />

program must supply the text word and its relocation information in an item.<br />

The minimum length of the item is three words; however, it may be larger. Any<br />

relocation of a text word, other than a simple relocation of the right address under the<br />

same location counter that applies to the text word, must be handled through special<br />

relocation items. Any number of special relocation items may be appended to the item.<br />

Figure 15–1 shows the ROR item format.<br />

0 n not used l r<br />

1 text word<br />

2 f zero lc address<br />

special relocation items<br />

.. . . .<br />

n-1 special relocation items<br />

Field Descriptions<br />

Word 0<br />

n<br />

l<br />

r<br />

Figure 15–1. ROR: Item Format<br />

Item length, including any special relocation items.<br />

Bits 16 and 17 of a left address field plus 10 sign bits, or 12 sign bits, for a left<br />

half-word field.<br />

Bits 16 and 17 of a right address field plus 10 sign bits, or 12 sign bits, for a right<br />

half-word field.<br />

7833 1733–004 15–3


ROR, ROR$–Relocatable Output Routine<br />

Word 1<br />

text word<br />

Word 2<br />

f<br />

lc<br />

Bit 3 = 1, right address (bits 20-35) relocatable.<br />

Bit 2 = 1, left address (bits 2-17) relocatable.<br />

Contains the location counter the text word is under, and by which relocation<br />

specified by f takes place. May be overridden by a type 013 special item.<br />

address<br />

Address of the text word.<br />

Words 3, 4, and so on, may contain special relocation items.<br />

Location Counter Formats<br />

Following are descriptions of the three types of location counters.<br />

• The Location Counter Relocation Item, type 011, is used for relocation by a location<br />

counter other than the one specified in S3 of word 2.<br />

The format is<br />

01 011 l r lc<br />

where:<br />

l<br />

r<br />

lc<br />

The left margin of the field of relocation (a bit number in the range 0–35).<br />

The right margin of the field of relocation (a bit number in the range 0–35,<br />

with r less than or equal to l).<br />

Location counter number; a signed 12-bit integer. The starting address of the<br />

location counter is added if lc is positive or subtracted if lc is negative.<br />

15–4 7833 1733–004


ROR, ROR$–Relocatable Output Routine<br />

• The External <strong>Reference</strong> Item (two words), type 012, is used for relocation by the<br />

value of an externally defined symbol.<br />

The format is<br />

02 012 l r signs<br />

where:<br />

l<br />

r<br />

signs<br />

sequence number of the external reference in the preamble<br />

The left margin of the field of relocation.<br />

The right margin of the field of relocation.<br />

Twelve bits of all zeros or ones, depending on whether the external reference is<br />

to be added or subtracted, respectively.<br />

• The Large Location Counter Item, type 013, format is:<br />

01 013 not used lc<br />

where lc is the location counter number the text will be under.<br />

If this special item is used, it must be the first special item appended to the item.<br />

This item overrides the lc in Word 2 of the item. This allows location counters<br />

greater than 63.<br />

ROR formats the text words and the relocation information into blocks and writes the<br />

blocks to the relocatable element.<br />

7833 1733–004 15–5


ROR, ROR$–Relocatable Output Routine<br />

15.3. EROR$, EROR$EB–End Relocatable Output<br />

Routine<br />

EROR$ terminates ROR after the last text word has been processed.<br />

EROR outputs the last block built by ROR and generates a transfer image. The transfer<br />

image is a special word group. The format is described in Section 5, “Relocatable Binary<br />

(RB) Format” of the Data Structures <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

Calling Sequence<br />

L A0,(transfer-addr,transfer-addr-lc)<br />

LMJ X11,EROR$ (or EROR$EB)<br />

error return<br />

normal return<br />

Note: If a transfer location is not specified, then A0 must be negative (for example, if<br />

the element is a subroutine).<br />

Parameters<br />

transfer-addr<br />

location of the first instruction to be executed in the main program.<br />

transfer-addr-lc<br />

location counter to which the address applies.<br />

Error Return<br />

The error return is taken when an I/O error occurs. The status is returned in A1.<br />

15.4. TBLWR$, TBLWR$EB–Write Table to File<br />

TBLWR$ writes the preamble constructed by the calling program to the program file that<br />

contains the relocatable text. ROR must have already written the element text to the<br />

program file, and EROR must have been called.<br />

An ER PFI$ is done to update the file's table of contents.<br />

The preamble consists of one to five tables. The entries in PARTBL+29 through 38<br />

(see Figure 14–1) are updated to reflect the preamble length, preamble location, and the<br />

element type (5 = relocatable). The format of the preamble is described in Section 5,<br />

“Relocatable Binary (RB) Format” of the Data Structures <strong>Programming</strong> <strong>Reference</strong><br />

<strong>Manual</strong>.<br />

15–6 7833 1733–004


Calling Sequence<br />

L,U A0,preamble-addr<br />

L,U A1,preamble-length<br />

LMJ X11,TBLWR$ (or TBLWR$EB)<br />

error return<br />

normal return<br />

Error Return<br />

The error return is taken when<br />

ROR, ROR$–Relocatable Output Routine<br />

• An I/O error occurs. A1 will contain the status.<br />

• An error occurs on the ER PFI$. A1 will equal 0 and A2 will be the status.<br />

15.5. Optimization Information<br />

ROR and the Collector are more efficient if the instructions and data are coded under<br />

control of location counters one and two, respectively. ROR has less processing to do<br />

and produces a more compact relocatable element. The Collector has a smaller bit<br />

stream to analyze.<br />

7833 1733–004 15–7


ROR, ROR$–Relocatable Output Routine<br />

15–8 7833 1733–004


Section 16<br />

SAR$–Symbolic Access Routines<br />

The Symbolic Access Routines (SAR$) allow the calling program to read and write<br />

system data format (SDF) files.<br />

SAR$ has four main functions:<br />

• READ<br />

Read symbolic images from SDF files, SDF elements, the READ$ file, or an alternate<br />

READ$ file.<br />

• WRITE<br />

Write symbolic images to SDF files, SDF elements, the standard PRINT$ file, the<br />

standard PUNCH$ file, alternate PRINT$ files, or alternate PUNCH$ files.<br />

• ATREAD<br />

Write a symbolic image to the current output stream and read a symbolic image<br />

from the current input stream.<br />

• COM<br />

Write a symbolic image to the operator's console and read a symbolic image from<br />

the operator's console.<br />

Symbolic images have traditionally been in the Fieldata, ASCII/ISO, or attributed<br />

character data (ACD) character sets. Additional coded character sets (CCS) have now<br />

been defined and are supported by the Symbolic Access Routines. A total of 63 CCSs<br />

are currently defined. Forty of these are referred to as ASCII-like. This means that the<br />

character set is essentially identical to the ASCII/ISO character set in the octal range 000<br />

through 0177, with any differences being minor. Refer to the ER <strong>Programming</strong><br />

<strong>Reference</strong> <strong>Manual</strong>, Table 14–1, for a detailed description of the CCSs. Throughout<br />

Section 16, wherever ASCII or ASCII/ISO is used, the SAR$ capabilities apply equally to<br />

all ASCII-like character sets.<br />

The SAR$ functions may be called from either PLUS or MASM programs. These<br />

functions are described in the following subsections.<br />

SAR$ is available in relocatable elements and in the <strong>SYSLIB</strong> common banks. The READ,<br />

ATREAD, and COM functions are in the common bank absolute <strong>SYSLIB</strong>$3. The WRITE<br />

function is in the common bank absolute <strong>SYSLIB</strong>$4. Appendix E lists the relocatable and<br />

common bank entry points for SAR$.<br />

7833 1733–004 16–1


SAR$–Symbolic Access Routines<br />

16.1. File Information Packet<br />

The file information packet (FIP) is used to pass information to the Symbolic Access<br />

Routines (SAR$) for input and output to SDF files, SDF elements, and alternate symbiont<br />

files. The SAR$ calling program must supply the D-bank storage space for the FIP.<br />

The file information packet is not required for reading from or writing to the standard<br />

symbiont (READ$ and PRINT$) files.<br />

All required information is placed in the FIP, and the address of the FIP is placed in the<br />

SAR$ READ or WRITE packets.<br />

16.1.1. PLUS Interface<br />

The type definition for the FIP is contained in the PLUS definition element<br />

SAR$FILEPKTD in the <strong>SYSLIB</strong> file SYS$LIB$*<strong>SYSLIB</strong> and may be obtained with the<br />

PLUS COPY statement “COPY ('SAR$FILEPKTD');”. The identifier of the FIP data<br />

structure type is SAR_FILE_INFO_PACKET. The length of the FIP is equal to the<br />

constant SAR_FILE_INFO_PACKET_WORD_LENGTH defined in the element<br />

SAR$FILEPKTD (current length is nine words). SAR_FILE_INFO_PACKET is defined as<br />

LOCATABLE.<br />

16.1.1.1. FIP Field Descriptions<br />

The following fields of the FIP are set by the calling program:<br />

PACKET_VERSION<br />

PLUS Attribute: 6-bit integer<br />

The FIP data structure version. The current version is equal to the constant<br />

SAR_FILE_INFO_PACKET_CURRENT_VERSION defined in the element<br />

SAR$FILEPKTD.<br />

ACCESS_TYPE<br />

PLUS Attribute: 6-bit status<br />

The type of input being accessed<br />

S'SDF_file' Input is from an SDF file.<br />

S'SDF_element' Input is from an SDF element.<br />

S'PROC' Input is from a PLUS, FORTRAN, or COBOL PROC.<br />

S'Alternate_symbiont' Input is from an alternate READ file.<br />

This field is set for input only; it is omitted for output. If input is from the runstream<br />

(READ$ file), the FIP address in the READ packet is set to NULL.<br />

16–2 7833 1733–004


PROC_CHARACTER_TYPE<br />

PLUS Attribute: 6-bit status<br />

The character set type of the PROC to be read<br />

S'Fieldata' Fieldata 6-bit characters.<br />

S'ASCII_ISO' ASCII/ISO 9-bit characters.<br />

S'ACD' Attributed character data (ACD).<br />

This field is defined only for the ACCESS_TYPE of S'PROC'.<br />

PROC_SOURCE_LANGUAGE_TYPE<br />

PLUS Attribute: 9-bit status<br />

The source language type of the PROC to be read<br />

SAR$–Symbolic Access Routines<br />

S'PLUS' The source language type is PLUS.<br />

S'FORTRAN' The PROC source language type is FORTRAN.<br />

S'COBOL' The PROC source language type is COBOL.<br />

This field is defined only for the ACCESS_TYPE of S'PROC'.<br />

FILE_NAME_BUFFER_BYTE_LENGTH<br />

PLUS Attribute: 9-bit integer<br />

The length in bytes of the buffer containing the internal file name; legal values are<br />

from 1 to 12 bytes. May be set to 12 if the file name is space-filled to 12 characters.<br />

ELEMENT_NAME_BUFFER_BYTE_LENGTH<br />

PLUS Attribute: 9-bit integer<br />

The length in bytes of the buffer containing the output element name; legal values<br />

are from 1 to 12 bytes. This field is set for output only; it is omitted for input. May<br />

be set to 12 if the element name is space-filled to 12 characters.<br />

VERSION_NAME_BUFFER_BYTE_LENGTH<br />

PLUS Attribute: 9-bit integer<br />

The length in bytes of the buffer containing the output version name; legal values are<br />

from 1 to 12 bytes. This field is set for output only; it is omitted for input. May be<br />

set to 12 if the version name is space-filled to 12 characters.<br />

7833 1733–004 16–3


SAR$–Symbolic Access Routines<br />

FILE_NAME_BUFFER_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the buffer containing the internal file name. The file name must be in<br />

the ASCII/ISO character set, with length from 1 to 12 characters.<br />

ELEMENT_NAME_BUFFER_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the buffer containing the output element name. The element name<br />

must be in the ASCII/ISO character set, with length from 1 to 12 characters. This<br />

field is used only for output and an OUTPUT_FILE_TYPE of S'SDF_element'.<br />

VERSION_NAME_BUFFER_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the buffer containing the output version name. The version name<br />

must be in the ASCII/ISO character set, with length from 1 to 12 characters. This<br />

field is used only for output and an OUTPUT_FILE_TYPE of S'SDF_element'.<br />

ELEMENT_FLAG_BITS<br />

PLUS Attribute: 12-bit logical<br />

The element flag bits as defined in the Program File Element Table, Data Structures<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>. This field is defined only if writing to an SDF<br />

element.<br />

ELEMENT_TYPE<br />

PLUS Attribute: 6-bit integer<br />

The symbolic element type; see the Data Structures <strong>Programming</strong> <strong>Reference</strong><br />

<strong>Manual</strong> for element type definitions. This field is defined only if writing to an SDF<br />

element.<br />

ELEMENT_SUBTYPE<br />

PLUS Attribute: 6-bit integer<br />

The symbolic element subtype; see 2.6 for element subtype definitions. This field is<br />

defined only if writing to an SDF element.<br />

16–4 7833 1733–004


ACTUAL_ELEMENT_CYCLE<br />

PLUS Attribute: 6-bit integer<br />

SAR$–Symbolic Access Routines<br />

The absolute cycle number of the SDF element. This field is defined only if reading<br />

from or writing to an SDF element. If reading from an SDF element and if the actual<br />

element cycle is not known, set this field to 0‘77’ to read all nondeleted element<br />

cycles.<br />

HIGHEST_SECTOR_ADDRESS<br />

PLUS Attribute: 24-bit integer<br />

The highest mass storage sector address assigned to the SDF file used for input or<br />

output. This field is not currently used.<br />

NEXT_READ_SECTOR_ADDRESS<br />

PLUS Attribute: 24-bit integer<br />

The mass storage sector address of the SDF input file to begin reading at. This field<br />

is not used for symbiont files.<br />

WORD_OFFSET_INTO_READ_SECTOR<br />

PLUS Attribute: 6-bit integer<br />

The word offset into the mass storage sector address of the SDF input file to begin<br />

reading at. This field is not used for symbiont files.<br />

NEXT_READ_LOCATION<br />

PLUS Attribute: word machine integer<br />

A one-word combination of NEXT_READ_SECTOR_ADDRESS and<br />

WORD_OFFSET_INTO_READ_SECTOR contained in bits 12 to 35 and in bits 0 to 5,<br />

respectively. (Bit 0 is the leftmost bit of the word.)<br />

NEXT_WRITE_SECTOR_ADDRESS<br />

PLUS Attribute: 24-bit integer<br />

The mass storage sector address of the SDF output file to begin writing at. This field<br />

is not used for symbiont files.<br />

WORD_OFFSET_INTO_WRITE_SECTOR<br />

PLUS Attribute: 6-bit integer<br />

The word offset into the mass storage sector address of the SDF output file to begin<br />

writing at. This field is not used for symbiont files.<br />

7833 1733–004 16–5


SAR$–Symbolic Access Routines<br />

NEXT_WRITE_LOCATION<br />

PLUS Attribute: word machine integer<br />

A one-word combination of NEXT_WRITE_SECTOR_ADDRESS and<br />

WORD_OFFSET_INTO_WRITE_SECTOR contained in bits 12 to 35 and in bits 0 to 5,<br />

respectively. (Bit 0 is the leftmost bit of the word.)<br />

16.1.1.2. READ and WRITE Field Requirements<br />

FIP fields required for the READ and WRITE functions of SAR$ are as follows:<br />

• Fields required for READ<br />

PACKET_VERSION<br />

ACCESS_TYPE<br />

FILE_NAME_BUFFER_ADDRESS<br />

FILE_NAME_BUFFER_BYTE_LENGTH<br />

NEXT_READ_LOCATION<br />

• Additional fields required for READ if the ACCESS_TYPE is S'SDF_element' or<br />

S'PROC'<br />

PROC_CHARACTER_TYPE<br />

PROC_SOURCE_LANGUAGE_TYPE<br />

ACTUAL_ELEMENT_CYCLE<br />

• Fields required for WRITE<br />

PACKET_VERSION<br />

FILE_NAME_BUFFER_ADDRESS<br />

FILE_NAME_BUFFER_BYTE_LENGTH<br />

NEXT_WRITE_LOCATION<br />

• Additional fields required for WRITE if the OUTPUT_FILE_TYPE is S'SDF_element'<br />

ELEMENT_NAME_BUFFER_ADDRESS<br />

ELEMENT_NAME_BUFFER_BYTE_LENGTH<br />

VERSION_NAME_BUFFER_ADDRESS<br />

VERSION_NAME_BUFFER_BYTE_LENGTH<br />

ELEMENT_FLAG_BITS<br />

ELEMENT_TYPE<br />

ELEMENT_SUBTYPE<br />

ACTUAL_ELEMENT_CYCLE<br />

The information that is stored in the FIP may be obtained from PARTBL, the externalized<br />

table produced by the preprocessor routines PREPRO and PREPRM.<br />

16–6 7833 1733–004


16.1.2. MASM Interface<br />

SAR$–Symbolic Access Routines<br />

The S$ARFIPDEF PROC generates the EQUFs defining the packet fields of the file<br />

information packet (FIP). The element SAR$PROCS contains this PROC. S$ARFIPDEF<br />

also equates the current packet version and word length of the FIP to labels<br />

FIP$CURVER and FIP$PWLEN, respectively. FIP$PWLEN is defined by the<br />

S$ARFIPDEF PROC (current length is nine words).<br />

Calling Format<br />

S$ARFIPDEF x-reg,b-reg,dispflg<br />

Parameters<br />

x-reg<br />

b-reg<br />

dispflg<br />

The X-register to be attached to the file information packet EQUFs. If it is omitted,<br />

no X-register is attached to the EQUFs.<br />

The B-register to be attached to the file information packet EQUFs. If it is omitted,<br />

no B-register is attached to the EQUFs.<br />

A flag to display a table of file information packet EQUFs. If it is set to 'D', the field<br />

names are displayed. Otherwise the field names are not displayed.<br />

Example<br />

$ASCII<br />

$INCLUDE ‘MAXR$’<br />

S$ARFIPDEF X7,,‘D’<br />

This PROC call generates the EQUFs using X7 and no B-register, and displays the file<br />

information packet fields.<br />

16.1.2.1. FIP Field Descriptions<br />

The following fields of the FIP are set by the calling program:<br />

FIP$VER<br />

The FIP data structure version. The current version is equal to label FIP$CURVER,<br />

defined by the S$ARFIPDEF PROC.<br />

7833 1733–004 16–7


SAR$–Symbolic Access Routines<br />

FIP$ACTYP<br />

The type of input being accessed<br />

0 Input is from an SDF file.<br />

1 Input is from an SDF element.<br />

2 Input is from a COBOL, FORTRAN, or PLUS PROC.<br />

3 Input is from an alternate READ file.<br />

This field is set for input only; it is omitted for output.<br />

FIP$PCHAR<br />

The character set type of the PROC to be read<br />

0 Fieldata 6-bit characters.<br />

01 ASCII/ISO 9-bit characters.<br />

077 Attributed character data (ACD).<br />

This field is defined only for the access type 2 (PROC).<br />

FIP$PLANG<br />

The source language type of the PROC to be read. For access type of PROC<br />

1 The PROC source language type is COBOL.<br />

2 The PROC source language type is FORTRAN.<br />

4 The PROC source language type is PLUS.<br />

This field is defined only for the access type 2 (PROC).<br />

FIP$FNLEN<br />

The length in bytes of the buffer containing the internal file name; legal values are<br />

from 1 to 12 bytes. May be set to 12 if the file name is space-filled to 12 characters.<br />

FIP$ENLEN<br />

The length in bytes of the buffer containing the input or output element name; legal<br />

values are from 1 to 12 bytes. May be set to 12 if the element name is space-filled<br />

to 12 characters.<br />

FIP$VNLEN<br />

The length in bytes of the buffer containing the input or output version name; legal<br />

values are from 1 to 12 bytes. May be set to 12 if the version name is space-filled to<br />

12 characters.<br />

16–8 7833 1733–004


FIP$FNBUF<br />

SAR$–Symbolic Access Routines<br />

The address of the buffer containing the internal file name. The file name must be in<br />

the ASCII/ISO character set, with length from 1 to 12 characters.<br />

FIP$ENBUF<br />

The address of the buffer containing the output element name. The element name<br />

must be in the ASCII/ISO character set, with length from 1 to 12 characters. This<br />

field is used only for output and an output file type (SW$OUTFILT) of 0 (SDF<br />

element).<br />

FIP$VNBUF<br />

The address of the buffer containing the output version name. The version name<br />

must be in the ASCII/ISO character set, with length from 1 to 12 characters. This<br />

field is used only for output and an output file type (SW$OUTFILT) of 0 (SDF<br />

element).<br />

FIP$EFB1<br />

The first set of 6 element flag bits (12 total), corresponding to bits 0 to 5 of word 3 in<br />

the Program File Element Table Item. See the Data Structures <strong>Programming</strong><br />

<strong>Reference</strong> <strong>Manual</strong> for further details. This field is defined only if reading from or<br />

writing to an SDF element.<br />

FIP$EFB2<br />

Second set of 6 element flag bits, corresponding to bits 6 to 11 of word 3 in the<br />

Program File Element Table Item. See the Data Structures <strong>Programming</strong> <strong>Reference</strong><br />

<strong>Manual</strong> for further details. This field is defined only if reading from or writing to an<br />

SDF element.<br />

FIP$ETYP<br />

The symbolic element type; see the Data Structures <strong>Programming</strong> <strong>Reference</strong><br />

<strong>Manual</strong>. This field is defined only if reading from or writing to an SDF element.<br />

FIP$ESTYP<br />

The symbolic element subtype; see 18.3 for element subtype definitions. This field<br />

is defined only if reading from or writing to an SDF element.<br />

FIP$ECYC<br />

The absolute cycle number of the SDF element. This field is defined only if reading<br />

from or writing to an SDF element. If reading from an SDF element and if the actual<br />

element cycle is not known, set this field to 0'77' to read all nondeleted element<br />

cycles.<br />

7833 1733–004 16–9


SAR$–Symbolic Access Routines<br />

FIP$HSEC<br />

The highest mass storage sector address assigned to the SDF file used for input or<br />

output. This is a 24-bit field contained in bits 12 to 35 of the word (bit 0 is the<br />

leftmost bit of the word). This field is not currently used.<br />

FIP$NRSEC<br />

The mass storage sector address of the input file to begin reading at. This field is a<br />

full word; however, S1 contains the word offset (FIP$NRWO), which is not part of<br />

the sector address. This field is not used for symbiont files.<br />

FIP$NRWO<br />

The word offset into the mass storage sector address of the SDF input file to begin<br />

reading at. This field is equated to S1 of FIP$NRSEC, and must be set after<br />

FIP$NRSEC is set. Otherwise it will be overwritten. This field is not used for<br />

symbiont files.<br />

FIP$NWSEC<br />

The mass storage sector address of the SDF output file to begin writing at. This<br />

field is a full word; however, S1 contains the word offset (FIP$NWWO) which is not<br />

part of the sector address. This field is not used for symbiont files.<br />

FIP$NWWO<br />

The word offset into the mass storage sector address of the SDF output file to begin<br />

writing at. This field is equated to S1 of FIP$NWSEC, and must be set after<br />

FIP$NWSEC is set. Otherwise it will be overwritten. This field is not used for<br />

symbiont files.<br />

16–10 7833 1733–004


16.1.2.2. READ and WRITE Field Requirements<br />

SAR$–Symbolic Access Routines<br />

FIP fields required for the READ and WRITE functions of SAR$ are as follows:<br />

• Fields required for READ<br />

FIP$VER<br />

FIP$ACTYP<br />

FIP$FNBUF<br />

FIP$FNLEN<br />

FIP$NRSEC<br />

• Additional fields required for READ if FIP$ACTYP is 1 or 2<br />

FIP$PCHAR<br />

FIP$PLANG<br />

FIP$ECYC<br />

• Fields required for WRITE<br />

FIP$VER<br />

FIP$FNBUF<br />

FIP$FNLEN<br />

FIP$NWSEC<br />

• Additional fields required for WRITE if SW$OUTFILT is 0<br />

FIP$VNBUF<br />

FIP$EFB2<br />

FIP$VNLEN<br />

FIP$ETYP<br />

FIP$ENBUF<br />

FIP$ESTYP<br />

FIP$ENLEN<br />

FIP$ECYC<br />

FIP$EFB1<br />

7833 1733–004 16–11


SAR$–Symbolic Access Routines<br />

16.2. SAR$ Internal Format<br />

All of the SDF images handled by the SAR$ functions are placed in internal format.<br />

Internal format provides a common means of handling SDF images in different formats<br />

(nonshift coded, shift-coded, ACD, and so forth). The READ, ATREAD, and COM<br />

functions of SAR$ return SDF images to the calling program in internal format.<br />

The calling program must supply images that will be written out by the WRITE, ATREAD,<br />

and COM functions of SAR$ in internal format.<br />

Internal format consists of the character part and the attribute part.<br />

The character part contains a sequential list of the actual characters contained in the<br />

image. The character part contains no shift codes, attributes, or other special<br />

information. The characters in the character part must be in the ASCII/ISO, ASCII-like, or<br />

JIS-16 (kanji) character sets.<br />

The attribute part contains the attributes that apply to the characters in the character<br />

part. Each attribute is represented as a one-word entry in the attribute table, with the<br />

format in Figure 16–1<br />

index type value<br />

0 17 18 26 27 35<br />

Figure 16–1. SAR$: Attribute Table Entry<br />

The index is an 18-bit integer that indicates the position of the character in the character<br />

part to which this attribute applies. When reading and writing ACD images, the index<br />

range begins with 1 and ends with n, where n is the last 9-bit byte in the character part.<br />

(An index is in 9-bit byte granularity.) When reading and writing shift coded images, the<br />

index range begins with 1 and ends with n + 1. In this case, an index value of n + 1<br />

corresponds to a shift coded image that ends with a shift code and is not followed by<br />

any additional characters. More than one attribute can have the same index. However,<br />

indexes must be in nondecreasing order.<br />

The type is a 9-bit octal value that describes the type of the attribute. The types that are<br />

currently defined are as follows:<br />

001 Reset all attributes to default values<br />

002 The character set type<br />

003 The width of the character<br />

004 The height of the character<br />

005 The horizontal spacing between characters (center to center)<br />

Any number of attributes may apply to the same character.<br />

The value is a 9-bit octal value that provides specific information for the attribute type.<br />

These values are defined in the PLUS COPY element, ACD$VALUES. Table 16-1 lists<br />

the possible values for attribute types.<br />

16–12 7833 1733–004


Type<br />

SAR$–Symbolic Access Routines<br />

Table 16–1. SAR$: Attribute Types and Values<br />

Value When<br />

Reading/ Writing<br />

Shift-coded Data<br />

Value When Reading/<br />

Writing ACD<br />

Description<br />

001 0 0 No value applies<br />

002 01<br />

020<br />

003, 004 0<br />

003<br />

004<br />

005<br />

006<br />

005 0<br />

001<br />

002<br />

003<br />

005<br />

007<br />

7833 1733–004 16–13<br />

0<br />

020<br />

0<br />

0106<br />

0132<br />

0170<br />

0360<br />

0<br />

not applicable<br />

0110<br />

0220<br />

0170<br />

0140<br />

ASCII/ISO or ASCII-like<br />

JIS-16 kanji<br />

Device-dependent default<br />

Seven point<br />

Nine point<br />

Twelve point<br />

Twenty-four point<br />

Device-dependent default<br />

2.5 cpi (characters per inch)<br />

10 cpi<br />

5 cpi<br />

6 cpi<br />

7.5 cpi<br />

Once an attribute type and value are applied to a character in the character part, that<br />

attribute type and value apply to all of the following characters in the character part.<br />

The attribute type and value remain active until either another value for that attribute<br />

type is applied or the end of the character part is reached. If several attributes with the<br />

same types but different values apply to the same character, the last attribute value is<br />

used.


SAR$–Symbolic Access Routines<br />

16–14 7833 1733–004


Section 17<br />

SAR$ READ<br />

17.1. READ Function/PLUS Interface<br />

The SAR$ READ procedures can be called directly from PLUS. These procedures are<br />

• SAR_OPEN_INPUT<br />

• SAR_READ<br />

• SAR_CLOSE_INPUT<br />

All SAR$ data structure definitions and procedure calls are contained in definition<br />

elements. These definitions and procedures may be obtained with the PLUS COPY<br />

statement.<br />

17.1.1. READ Packet Data Structure Description<br />

The SAR$ READ function requires a READ packet data structure for the<br />

SAR_OPEN_INPUT, SAR_READ, and SAR_CLOSE_INPUT procedure calls.<br />

The type definition for this data structure is contained in the element SAR$RPKTD in the<br />

<strong>SYSLIB</strong> file (SYS$*RLIB$ or SYS$LIB$*<strong>SYSLIB</strong>) and may be obtained with the COPY<br />

statement. The identifier for the READ packet data structure type is<br />

SAR_READ_PACKET.<br />

The calling program must provide storage space for the READ packet data structure plus<br />

any necessary buffers and tables, since SAR$ does not have any D-bank storage.<br />

The length of the READ packet is equal to the constant<br />

SAR_READ_PACKET_WORD_LENGTH, defined in the element SAR$RPKTD<br />

(current length is 36 words). SAR_READ_PACKET is defined as LOCATABLE.<br />

The calling program places information in the READ packet data structure and passes the<br />

address of the data structure to SAR$ through the procedure calls.<br />

7833 1733–004 17–1


SAR$ READ<br />

17.1.1.1. Required Information for READ Procedures<br />

The calling program must set the following fields of the READ packet to appropriate<br />

values.<br />

PACKET_VERSION<br />

PLUS Attribute: 6-bit integer<br />

The READ packet data structure version. The current version is equal to the<br />

constant SAR_READ_PACKET_CURRENT_VERSION defined in the element<br />

SAR$RPKTD. The PACKET_VERSION must not be modified between calls to the<br />

SAR$ READ routine.<br />

INPUT_FILE_INFO_PKT_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the input file information packet. This packet is supplied by the caller<br />

(see 16.1). Set to NULL if input is from the runstream.<br />

INPUT_BUFFER_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the input buffer, used to read images from the input file or element.<br />

This field is defined only if input is from an SDF file or element. It is omitted if input<br />

is from the runstream or an alternate READ$ file. Subsection 17.1.2 describes the<br />

input buffer.<br />

INPUT_BUFFER_WORD_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in words of the input buffer. It must be of length (28* dpf * n), where<br />

dpf is the disk prepping factor and n is a positive integer. This field is defined only if<br />

input is from an SDF file or element. It is omitted if input is from the runstream or<br />

an alternate READ$ file.<br />

IMAGE_BUFFER_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the input image buffer, into which SAR$ places individual images<br />

from the input buffer. Subsection 17.1.2 describes the image buffer.<br />

IMAGE_BUFFER_WORD_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in words of the input image buffer.<br />

17–2 7833 1733–004


TEXT_BUFFER_ADDRESS:<br />

PLUS Attribute: word pointer<br />

SAR$ READ<br />

The address of the input text buffer, into which SAR$ places the character text of<br />

the image read. Subsection 17.1.2 describes the text buffer.<br />

TEXT_BUFFER_BYTE_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in 9-bit bytes of the input text buffer.<br />

ATTRIBUTE_TABLE_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the input attribute table where SAR$ places the attributes describing<br />

the character text of the image read. This field is undefined if the<br />

ATTRIBUTE_TABLE_WORD_LENGTH is zero. Subsection 17.1.2 describes the<br />

format of the attribute table.<br />

ATTRIBUTE_TABLE_WORD_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in words of the input attribute table. A length of zero indicates there is<br />

no input attribute table.<br />

17.1.1.2. Optional Information for READ Procedures<br />

The calling program may optionally set the following fields of the READ packet. The<br />

default values are obtained by zero-filling the READ packet before placing any<br />

information in the packet.<br />

SELECT_LIST_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the select list that specifies which attributes to return to the caller.<br />

This field is undefined if SELECT_LIST_BYTE_LENGTH is zero. Subsection 17.1.2<br />

describes the format of the select list.<br />

SELECT_LIST_BYTE_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in 9-bit bytes of the select list. A length of zero indicates there is no<br />

select list (default).<br />

7833 1733–004 17–3


SAR$ READ<br />

REQUEST_TYPE<br />

PLUS Attribute: 6-bit status<br />

The requested type of input:<br />

S'Pass_embedded_KANJI'<br />

Do not search for embedded shift-coded kanji in ASCII/ISO (default).<br />

S'Translate_embedded_KANJI'<br />

Search for any embedded shift-coded kanji in ASCII/ISO input, and convert it into<br />

internal format (text part and attributes part). Subsection 16.2 describes internal<br />

format.<br />

LINE_NUMBER_FORMAT<br />

PLUS Attribute: 6-bit status<br />

The format of line numbers returned by SAR$ to the caller.<br />

S'Use_input_numbers'<br />

Use the line number type read with the input image; it may be either a CTS or<br />

fractional line number (see LINE_NUMBER_TYPE in 17.1.1.3). If no line number<br />

exists for the input image, SAR$ increments the last line number by 1. If the<br />

input contains mixed LINE_NUMBER_TYPEs, the line number will be compared<br />

to the previous line number, and if necessary, incremented. If the input does<br />

not have any line numbers, SAR$ generates sequential line numbers with initial<br />

value 1 and increment value 1 (default).<br />

S'Generate_CTS'<br />

SAR$ generates sequential CTS line numbers with an initial value of 10 and an<br />

increment value of 10.<br />

S'Generate_fractional'<br />

SAR$ generates sequential fractional line numbers with an initial value of 10 and<br />

an increment value of 10.<br />

S'No_line_numbers'<br />

No line numbers are returned to the caller.<br />

17–4 7833 1733–004


UNTRANSLATE_MODE<br />

PLUS Attribute: 6-bit status<br />

The untranslate mode flag setting:<br />

S'Off'<br />

S'On'<br />

SAR$ READ<br />

An error is returned if SAR$ reads a character set type other than 00 (Fieldata),<br />

01 (ASCII/ISO), 077 (ACD) (default), or ASCII-like.<br />

All input is passed to the caller untranslated.<br />

SDF_CONTROL_RECORDS_TO_PASS<br />

PLUS Attribute: word logical<br />

This field specifies which SDF control records to return to the caller. Bits 1 to 32<br />

may be set by the caller, where bit 1 is the leftmost bit of the field. If bit n is set, the<br />

control record type ( n-1 + 040) is returned to the caller. The image control word of<br />

the control record is returned in SDF_IMAGE_CONTROL_WORD, and any data<br />

words of the control record are returned in the text buffer. If this field is set to zero,<br />

no control records are returned to the caller (default).<br />

Note that the control record type 051 is not returned unless it is used to continue a<br />

type 061 control record. Therefore, it is suggested that the caller specify that type<br />

051 records be returned if type 061 records are desired, and vice-versa.<br />

READ_ADDRESS_SECTOR<br />

PLUS Attribute: 24-bit integer<br />

The mass storage sector address of the next image to be read. This field is used if<br />

the image to be read is not the next sequential image. If this field is set to zero, the<br />

next sequential image is read (default). This field is undefined if the input is not from<br />

an SDF file or element.<br />

7833 1733–004 17–5


SAR$ READ<br />

READ_ADDRESS_WORD_OFFSET<br />

PLUS Attribute: 6-bit integer<br />

The word offset into the mass storage sector address of the next image to be read.<br />

This field is used if the image to be read is not the next sequential image. If this<br />

field is set to zero, the next sequential image is read (default). This field is undefined<br />

if the input is not from an SDF file or element.<br />

READ_ADDRESS<br />

PLUS Attribute: word machine integer<br />

A one-word combination of the READ_ADDRESS_SECTOR and the<br />

READ_ADDRESS_WORD_OFFSET fields, where these fields are contained in bits<br />

13 to 36 and 1 to 6, respectively. (Bit 1 is the leftmost bit of the READ_ADDRESS<br />

field.)<br />

17.1.1.3. Information Returned by READ Procedures<br />

The following fields of the READ packet contain values returned by the SAR$ READ<br />

procedures to the calling program.<br />

CALL_STATUS<br />

PLUS Attribute: 18-bit status<br />

The status of the current call to SAR_OPEN_INPUT, SAR_READ, or<br />

SAR_CLOSE_INPUT. See Table 17–3 for an explanation of the READ procedure call<br />

status codes. This field may also be referenced as an 18-bit logical field with label<br />

CALL_STATUS_CODE.<br />

SUB_STATUS_CODE<br />

PLUS Attribute: 12-bit logical<br />

This field contains additional information for particular CALL_STATUS codes.<br />

IO_STATUS<br />

PLUS Attribute: 6-bit status<br />

The status of any I/O operations performed by the READ procedures. See<br />

Table 17–4 for the I/O status lists. This field may also be referenced as a 6-bit logical<br />

field with label IO_STATUS_CODE.<br />

17–6 7833 1733–004


READ_STATUS_WORD<br />

PLUS Attribute: word logical<br />

A one-word combination of CALL_STATUS, SUB_STATUS, and IO_STATUS<br />

contained in H2, T1, and S3, respectively.<br />

SYMB_STATUS_WORD<br />

PLUS Attribute: word logical<br />

The status word returned from an ER SYMB$ request.<br />

SAR$ READ<br />

See SYMB$ section, Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further details on<br />

the ER SYMB$ status word.<br />

RECOMMENDED_BUFFER_SIZE<br />

PLUS Attribute: 18-bit integer<br />

The recommended buffer or table size when an invalid length is specified or when<br />

an overflow occurs.<br />

TEXT_LENGTH_IN_BYTES<br />

PLUS Attribute: 18-bit integer<br />

The length in 9-bit bytes of the character text returned in the text buffer.<br />

NUMBER_OF_ATTRIBUTES<br />

PLUS Attribute: 18-bit integer<br />

The number of attributes returned in the attribute table.<br />

CHARACTER_TYPE<br />

PLUS Attribute: 6-bit status<br />

The character set type of the image returned to the caller:<br />

S'Fieldata' Fieldata 6-bit characters<br />

S'ASCII_ISO' ASCII/ISO 9-bit characters<br />

S'ACD' Attributed character data (ACD)<br />

A value of any ASCII-like character set type defined in Table H–1.<br />

If UNTRANSLATE_MODE is set to S'Off', then any Fieldata images read are<br />

translated to ASCII/ISO before they are returned to the caller. See 17.3 for details on<br />

allowed input character set types.<br />

7833 1733–004 17–7


SAR$ READ<br />

CHARACTER_CODE<br />

PLUS Attribute: 6-bit logical)<br />

The character set type of the image returned to the caller after any translation:<br />

0 Fieldata 6-bit characters<br />

01 ASCII/ISO 9-bit characters<br />

077 Attributed character data (ACD)<br />

A value of any ASCII-like character set type in Table H–1.<br />

If UNTRANSLATE_MODE is set to S'Off', then any Fieldata images read are<br />

translated to ASCII/ISO before they are returned to the caller. See 17.3 for details on<br />

allowed input character set types.<br />

INPUT_CHARACTER_CODE<br />

PLUS Attribute: 6-bit status<br />

The character set type of the image in the source input file or element. Contains the<br />

code type from the last 050 or 042 control record encountered in the input file or<br />

element.<br />

IMAGE_ADDRESS_SECTOR<br />

PLUS Attribute: 24-bit integer<br />

The mass storage sector address of the SDF image read. This field is undefined if<br />

input is from the runstream or an alternate READ$ file.<br />

IMAGE_ADDRESS_WORD_OFFSET<br />

PLUS Attribute: 6-bit integer<br />

The word offset into the mass storage sector address of the SDF image read. This<br />

field is undefined if input is from the runstream or an alternate READ$ file.<br />

IMAGE_ADDRESS<br />

PLUS Attribute: word machine integer<br />

This field is a one word combination of IMAGE_ADDRESS_SECTOR and<br />

IMAGE_ADDRESS_WORD_OFFSET, contained in bits 13 to 36 and in bits 1 to 6,<br />

respectively. (Bit 1 is the left-most bit of the field.)<br />

17–8 7833 1733–004


LINE_NUMBER_TYPE<br />

PLUS Attribute: 3-bit condition<br />

The type of line number returned with the image read.<br />

S'None'<br />

S'CTS'<br />

SAR$ READ<br />

No line number was read from the input; an SAR$ generated line number is<br />

returned. See LINE_NUMBER_FORMAT in 17.1.1.2.<br />

A CTS line number is returned.<br />

S'Fractional'<br />

A fractional line number is returned.<br />

LINE_NUMBER_INTEGER_PART<br />

PLUS Attribute: word integer<br />

The line number returned by SAR$. It may be a CTS line number, the integer part of<br />

a fractional line number, or a generated sequential line number (see<br />

LINE_NUMBER_TYPE).<br />

LINE_NUMBER_FRACTIONAL_PART (1:4)<br />

PLUS Attribute: four one-word integers<br />

The fractional part of fractional line numbers returned by SAR$. Each word of the<br />

array contains 10 digits of the fraction. This field is defined only if<br />

LINE_NUMBER_TYPE is S'Fractional'.<br />

SDF_IMAGE_CONTROL_WORD<br />

PLUS Attribute: word logical<br />

The image control word for the SDF record read. This field is defined only if input is<br />

from an SDF file or element. If bit 1 of this field is set, a control record was read; if<br />

bit 1 of this field is clear, a data record was read.<br />

If a control record was read, SDF_IMAGE_CONTROL_WORD has three subfields<br />

that are overlaid on SDF_IMAGE_CONTROL_WORD:<br />

CONTROL_RECORD_TYPE<br />

PLUS Attribute: 6-bit logical<br />

The type of control record read (an octal code from 040 to 077).<br />

7833 1733–004 17–9


SAR$ READ<br />

CONTROL_RECORD_WORD_LENGTH<br />

PLUS Attribute: 6-bit integer<br />

The length in words of the control record read.<br />

CONTROL_RECORD_CHAR_TYPE<br />

PLUS Attribute: 6-bit status<br />

The character set type of the control record, if applicable to this control record<br />

type (see the CHARACTER_TYPE field).<br />

If a data record was read, SDF_IMAGE_CONTROL_WORD has two subfields that<br />

are overlaid on SDF_IMAGE_CONTROL_WORD.<br />

DATA_RECORD_WORD_LENGTH<br />

PLUS Attribute: 12-bit integer<br />

The length in words of the data record read.<br />

DATA_RECORD_CHAR_TYPE<br />

PLUS Attribute: 6-bit status<br />

The character set type of the data record, if applicable to this input file type (see the<br />

CHARACTER_TYPE field).<br />

See the Data Structures <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> on SDF image control words.<br />

17.1.2. Buffers and Tables for PLUS READ Procedures<br />

The SAR$ READ function requires that an input (I/O) buffer, an image buffer, a text<br />

buffer, an attribute table, and a select list be supplied by the calling program.<br />

• Input buffer<br />

The input buffer is used to read from mass storage files. The calling program never<br />

needs to access the input buffer, but it must provide it to SAR$. If the calling<br />

program is using both the READ and WRITE functions of SAR$, then it cannot use<br />

the same I/O buffer for both functions. The calling program must provide a separate<br />

input and output buffer for each function.<br />

• Image buffer<br />

The image buffer is used to extract individual images from the input buffer. This<br />

buffer is necessary because images can contain information other than characters,<br />

such as attributes and ACD formats. The calling program never needs to access the<br />

image buffer, but it must provide it to SAR$. The calling program using the READ<br />

and WRITE functions can use the same image buffer for both functions.<br />

17–10 7833 1733–004


SAR$ READ<br />

• Text buffer<br />

The text buffer is used to return the characters contained in the image to the calling<br />

program. The characters are taken from the image buffer and placed sequentially in<br />

the text buffer, regardless of the format of the original image or any attributes that<br />

may apply to them. The text buffer provides one part of internal format (see 16.2).<br />

The calling program using the READ and WRITE functions can use the same text<br />

buffer for both functions.<br />

• Attribute table<br />

The attribute table is used to return to the calling program the attributes that apply to<br />

the characters in the text buffer. Each attribute has a one-word entry in the attribute<br />

table which follows the format in Figure 17–1.<br />

index type value<br />

0 17 18 26 27 35<br />

Figure 17–1. SAR$: Attribute Table Entry<br />

The attribute table provides the other part of internal format (see 16.2). If the images<br />

read by SAR$ do not contain any attributes or if UNTRANSLATE_MODE is set to<br />

S'On', then the attribute table may be omitted by setting<br />

ATTRIBUTE_TABLE_ADDRESS to null (zero). The calling program using the READ<br />

and WRITE functions can use the same attribute table buffer for both functions.<br />

• Select list<br />

The select list is used to determine which SAR$ attributes are returned to the calling<br />

program. It contains a sequential list of attribute types that are returned. Attribute<br />

types that are not on the select list are not returned. For example, if the calling<br />

program wants attribute types 3, 4, and 5 returned, the first word of the select list<br />

would be 003004005000. If the select list is omitted, all attribute types are returned<br />

to the calling program.<br />

The calling program must provide all buffers and tables. The type definitions for the<br />

buffers and tables, and definitions for the default buffer and table lengths, are contained<br />

in the element SAR$DEFN. SAR$DEFN is in the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or<br />

SYS$*RLIB$. This element is obtained with the COPY statement. These definitions<br />

simplify the creation of required tables and buffers for the calling program.<br />

7833 1733–004 17–11


SAR$ READ<br />

The default buffer and table lengths are listed in Table 17–1.<br />

Table 17–1. SAR$: PLUS READ Buffer and Table<br />

Length Defaults<br />

Identifier Value<br />

SAR_IO_BUFFER_WORD_LENGTH 448<br />

SAR_IMAGE_BUFFER_WORD_LENGTH 63<br />

SAR_TEXT_BUFFER_BYTE_LENGTH 132<br />

SAR_ATTRIBUTE_TABLE_WORD_LENGTH 40<br />

SAR_SELECT_LIST_BYTE_LENGTH 4<br />

The buffer and table type definitions are listed in Table 17–2.<br />

Table 17–2. SAR$: PLUS READ Buffer and Table Type<br />

Definitions<br />

Identifier Type<br />

SAR_IO_BUFFER 448 words logical locatable<br />

SAR_IMAGE_BUFFER 63 words logical locatable<br />

SAR_TEXT_BUFFER 132 ASCII characters locatable<br />

SAR_ATTRIBUTE_TABLE 40 words logical locatable<br />

SAR_SELECT_LIST 4 bytes logical locatable<br />

The element SAR$DEFN also contains other definitions necessary to SAR$.<br />

17.1.3. READ Procedures Called from PLUS<br />

The procedures for the READ function are:<br />

• SAR_OPEN_INPUT<br />

• SAR_READ<br />

• SAR_CLOSE_INPUT<br />

The declarations for these procedures are contained in the element SAR$READ$DG, in<br />

the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or SYS$*RLIB$. This element may be obtained with<br />

the COPY statement.<br />

SAR$READ$DG contains all three procedure declarations. All of the READ procedure<br />

modules are compiled with the G option, using the IBJ$ calling sequence.<br />

17–12 7833 1733–004


17.1.3.1. SAR_OPEN_INPUT Procedure Call<br />

SAR$ READ<br />

The READ packet data structure must be initialized before any input images are read.<br />

The SAR_OPEN_INPUT procedure performs the READ packet initialization.<br />

Initial Conditions<br />

The calling program sets the following parameters in the READ packet to appropriate<br />

values before calling SAR_OPEN_INPUT:<br />

• Required parameters (described in 17.1.1.1)<br />

PACKET_VERSION<br />

INPUT_FILE_INFO_PKT_ADDRESS<br />

INPUT_BUFFER_ADDRESS<br />

INPUT_BUFFER_WORD_LENGTH<br />

IMAGE_BUFFER_ADDRESS<br />

IMAGE_BUFFER_WORD_LENGTH<br />

• Optional parameters (described in 17.1.1.2)<br />

SELECT_LIST_ADDRESS<br />

SELECT_LIST_BYTE_LENGTH<br />

REQUEST_TYPE<br />

LINE_NUMBER_FORMAT<br />

UNTRANSLATE_MODE<br />

SDF_CONTROL_RECORDS_TO_PASS<br />

Note: It is recommended that the calling program zero-fill the READ packet before<br />

placing any parameters in the packet.<br />

Calling Format<br />

PROCEDURE SAR_OPEN_INPUT<br />

(READ_PACKET_ADDRESS: WORD MACHINE POINTER)<br />

IMPORTED ('SAR$OPENI$PG');<br />

Returns<br />

SAR_OPEN_INPUT returns the initialization status in the packet in CALL_STATUS. If the<br />

status is S'Normal', the initialization of the READ packet is successful. Otherwise an<br />

error has occurred, and CALL_STATUS contains the status code. See 17.1.4 for a list of<br />

the READ function status codes.<br />

7833 1733–004 17–13


SAR$ READ<br />

17.1.3.2. SAR_READ Procedure Call<br />

The SAR_READ procedure obtains one image from the input and returns the character<br />

text and attributes of the image to the calling program.<br />

Initial Conditions<br />

The calling program sets the following parameters in the READ packet to appropriate<br />

values before calling SAR_READ:<br />

• Required parameters (described in 17.1.1.1)<br />

TEXT_BUFFER_ADDRESS<br />

TEXT_BUFFER_BYTE_LENGTH<br />

ATTRIBUTE_TABLE_ADDRESS<br />

ATTRIBUTE_TABLE_WORD_LENGTH<br />

• Optional parameters (described in 17.1.1.2)<br />

SELECT_LIST_ADDRESS<br />

SELECT_LIST_BYTE_LENGTH<br />

READ_ADDRESS_SECTOR<br />

READ_ADDRESS_WORD_OFFSET<br />

Calling Format<br />

PROCEDURE SAR_READ<br />

(READ_PACKET_ADDRESS: WORD MACHINE POINTER)<br />

IMPORTED ('SAR$READ$PG');<br />

Returns<br />

Each call to SAR_READ reads one image from the input and returns the character text in<br />

the text buffer, the attributes in the attribute table, and other information in the READ<br />

packet. SAR_READ does not space-fill the text buffer if the text length is shorter than<br />

the text buffer length. If the character text is longer than the text buffer, SAR_READ<br />

truncates the text to the length of the text buffer and returns an error status in<br />

CALL_STATUS.<br />

SAR_READ returns the calling status in the READ packet field CALL_STATUS. If the<br />

status is S'Normal', then the read was successful.<br />

The following fields contain information returned by SAR$ to the caller:<br />

• Character text<br />

SAR_READ returns the character text of the image read in the text buffer and the<br />

character text length in TEXT_LENGTH_IN_BYTES. The length is in 9-bit bytes<br />

(characters).<br />

• Character type<br />

The character set type of the image read is returned in the field CHARACTER_TYPE.<br />

The octal code of the character set type is returned in the field CHARACTER_CODE.<br />

17–14 7833 1733–004


SAR$ READ<br />

• Attributes<br />

If there are any attributes that apply to the character text, they are returned in the<br />

attribute table. The number of attributes is returned in NUMBER_OF_ATTRIBUTES.<br />

• Line number<br />

CTS, fractional, and generated sequential line numbers are returned in the field<br />

LINE_NUMBER_INTEGER_PART. Fractional line numbers are returned in the array<br />

LINE_NUMBER_FRACTIONAL_PART (1:4). The line number type is returned in the<br />

field LINE_NUMBER_TYPE.<br />

• Image location<br />

The mass storage sector address and word offset of the image read are returned in<br />

the fields IMAGE_ADDRESS_SECTOR and IMAGE_ADDRESS_WORD_OFFSET,<br />

respectively.<br />

• Control word<br />

The image control word for data or control records is returned in the field<br />

SDF_IMAGE_CONTROL_WORD. If a control record was read, any data words of the<br />

control record are returned to the caller in the text buffer.<br />

If SAR_READ encounters an end-of-file condition, the CALL_STATUS field of the READ<br />

packet is set to status S'End_of_file'.<br />

If the status returned from SAR_READ is not S'Normal', then an error has occurred, and<br />

CALL_STATUS contains the status code. See 17.1.4 for a list of READ function status<br />

codes.<br />

17.1.3.3. SAR_CLOSE_INPUT Procedure Call<br />

The SAR_CLOSE_INPUT procedure closes the input operation, which must be done<br />

when all input is completed.<br />

Calling Format<br />

PROCEDURE SAR_CLOSE_INPUT<br />

(READ_PACKET_ADDRESS: WORD MACHINE POINTER)<br />

IMPORTED ('SAR$CLOSI$PG');<br />

Returns<br />

SAR_CLOSE_OUTPUT returns the calling status in the READ packet field<br />

CALL_STATUS. If the status is S'Normal', then the close was successful.<br />

If the status returned from SAR_CLOSE_OUTPUT is not S'Normal', then an error has<br />

occurred and CALL_STATUS contains the status code. See 17.1.4 for a list of READ<br />

function status codes.<br />

7833 1733–004 17–15


SAR$ READ<br />

17.1.3.4. Example<br />

The following example shows the SAR$ READ function in a PLUS program, reading SDF<br />

input:<br />

COPY (‘SAR$DEFN’);<br />

COPY (‘SAR$RPKTD’);<br />

COPY (‘SAR$READ$DG’);<br />

COPY (‘SAR$FILEPKTD’);<br />

DECLARE READ_PKT: SAR_READ_PACKET,<br />

IO_BUF: SAR_IO_BUFFER,<br />

IMAGE_BUF: SAR_IMAGE_BUFFER,<br />

TEXT_BUF: SAR_TEXT_BUFFER,<br />

ATTRIBUTE_TBL: SAR_ATTRIBUTE_TABLE,<br />

FILE_PKT: SAR_FILE_INFO_PACKET;<br />

.<br />

.<br />

.<br />

READ_PKT.PACKET_VERSION:= SAR_READ_PACKET_CURRENT_VERSION;<br />

READ_PKT.INPUT_FILE_INFO_PKT_ADDRESS:= LOC(FILE_PKT);<br />

READ_PKT.INPUT_BUFFER_ADDRESS:= LOC(IO_BUF);<br />

READ_PKT.INPUT_BUFFER_WORD_LENGTH:= SAR_IO_BUFFER_WORD_LENGTH;<br />

READ_PKT.IMAGE_BUFFER_ADDRESS:= LOC(IMAGE_BUF);<br />

READ_PKT.IMAGE_BUFFER_WORD_LENGTH:= SAR_IMAGE_BUFFER_WORD_LENGTH;<br />

READ_PKT.TEXT_BUFFER_ADDRESS:= LOC(TEXT_BUF);<br />

READ_PKT.TEXT_BUFFER_BYTE_LENGTH:= SAR_TEXT_BUFFER_BYTE_LENGTH;<br />

READ_PKT.ATTRIBUTE_TABLE_ADDRESS:= LOC(ATTRIBUTE_TBL);<br />

READ_PKT.ATTRIBUTE_TABLE_WORD_LENGTH:= SAR_ATTRIBUTE_TABLE_WORD_LENGTH;<br />

.<br />

.<br />

.<br />

SAR_OPEN_INPUT(LOC(READ_PKT));<br />

IF READ_PKT.CALL_STATUS NE S’Normal’<br />

THEN BEGIN<br />

PROCESS_READ_ERROR;<br />

RETURN;<br />

END;<br />

.<br />

.<br />

.<br />

SAR_EOF:= FALSE;<br />

WHILE NOT SAR_EOF DO<br />

BEGIN<br />

SAR_READ(LOC(READ_PKT));<br />

CASEENTRY READ_PKT.CALL_STATUS<br />

CASE S ‘End_of_file’ : SAR_EOF:= TRUE;<br />

CASE S ‘Normal’ :<br />

BEGIN<br />

.<br />

.<br />

.<br />

END;<br />

17–16 7833 1733–004


CASE * :<br />

BEGIN<br />

PROCESS_READ_ERROR;<br />

RETURN;<br />

END;<br />

ENDCASE;<br />

END;<br />

.<br />

.<br />

.<br />

SAR_CLOSE_INPUT(LOC(READ_PKT));<br />

IF READ_PKT.CALL_STATUS NE S ‘Normal’<br />

THEN BEGIN<br />

PROCESS_READ_ERROR;<br />

RETURN;<br />

END;<br />

SAR$ READ<br />

In this example, the COPY statement obtains the SAR$ definitions for the buffers and<br />

tables, READ packet, READ procedures, and file information packet. The SAR$ data<br />

structures are declared by using the definitions contained in elements SAR$DEFN,<br />

SAR$RPKTD, and SAR$FILEPKTD.<br />

The READ packet is initialized by assigning appropriate values to all necessary fields.<br />

All other packet fields take the default values if the READ packet is zero-filled.<br />

The SAR_READ_PACKET_CURRENT_VERSION constant is defined in the SAR$RPKTD<br />

element. The buffer length constants are defined in the SAR$DEFN element.<br />

The READ function is initialized by the calling SAR_OPEN_INPUT procedure, passing the<br />

READ packet address as a parameter. If the CALL STATUS field of the READ packet<br />

(returned by SAR$) is not status ‘Normal', the error is processed.<br />

The SAR_READ procedure reads one SDF image at a time until an end-of-file condition or<br />

an error occurs. When all images are read, the READ function is closed by calling the<br />

SAR_CLOSE_INPUT procedure.<br />

17.1.4. Status Lists for PLUS READ Procedures<br />

The READ procedure call status codes listed in Table 17–3 may be returned to the caller<br />

in the CALL_STATUS field of the READ packet. These CALL_STATUS codes are for<br />

SAR_READ_PACKET_CURRENT_VERSION = 3 and above. A list of all call status codes<br />

is available as READ_CALL_STATUS_LIST, an 18-bit status data entity defined in the<br />

element SAR$RPKTD.<br />

Table 17–3. SAR$: READ Procedure CALL_STATUS Codes<br />

Octal Code Status<br />

0 Normal return from SAR$.<br />

01 End-of-file condition reached by SAR_READ.<br />

7833 1733–004 17–17


SAR$ READ<br />

Table 17–3. SAR$: READ Procedure CALL_STATUS Codes<br />

Octal Code Status<br />

02 An I/O error has occurred in a READ procedure. See the IO_STATUS_CODE<br />

field for the status code and Table 17–4.<br />

03 An outdated READ packet version is being used.<br />

04 An invalid READ packet version is being used.<br />

05 An invalid value is specified for LINE_NUMBER_FORMAT.<br />

06 The value for IMAGE_BUFFER_ADDRESS is NULL; an address must be<br />

given for the input image buffer.<br />

07 The IMAGE_BUFFER_WORD_LENGTH is zero; a length must be given for<br />

the input image buffer.<br />

010 An invalid value is specified for REQUEST_TYPE.<br />

011 An invalid value is specified for UNTRANSLATE_MODE.<br />

012 The value for INPUT_BUFFER_WORD_LENGTH is too small; use the word<br />

length returned in RECOMMENDED_BUFFER_SIZE.<br />

013 The input file or element accessed is not SDF.<br />

014 An invalid value is specified in the ACCESS_TYPE field of the file information<br />

packet.<br />

015 An invalid address is specified in the READ_ADDRESS field; either the word<br />

offset is greater than 27 or the sector address is greater than the highest<br />

mass storage sector address of the file.<br />

016 The input image is too long to fit in the image buffer. The image buffer word<br />

length necessary to hold the entire image is returned in the field<br />

RECOMMENDED_BUFFER_SIZE. To reread the image, call SAR_READ with<br />

a larger IMAGE_BUFFER and IMAGE_BUFFER_WORD_LENGTH, and set the<br />

READ_ADDRESS to IMAGE_ADDRESS returned on the previous call.<br />

017 The character text is too long to fit in the text buffer and has been truncated.<br />

The text buffer byte length necessary to hold the character text is returned in<br />

the field RECOMMENDED_BUFFER_SIZE.<br />

020 The number of attributes is too large to fit in the attribute table. The attribute<br />

table word length necessary to hold all the attributes is returned in the field<br />

RECOMMENDED_BUFFER_SIZE.<br />

021 A partial image was read by SYMB$; call SAR_READ again to continue<br />

reading the image.<br />

022 An invalid SDF file or element label control record was read.<br />

023 An invalid SDF control record was read.<br />

024 The image read contains incorrectly formatted ACD or incorrectly formatted<br />

embedded shift-coded kanji.<br />

17–18 7833 1733–004


Table 17–3. SAR$: READ Procedure CALL_STATUS Codes<br />

Octal Code Status<br />

025 An invalid character set type was read.<br />

SAR$ READ<br />

026 The READ packet is not initialized; a call to SAR_OPEN_INPUT must be made<br />

before calls to SAR_READ or SAR_CLOSE_INPUT.<br />

027 An incorrect ACD subroutine version is being used with SAR$.<br />

030 The file name buffer address in the FIP is NULL; an address of an SDF file<br />

name must be specified.<br />

031 The file name buffer address in the FIP is NULL; an address of a symbiont file<br />

name must be specified.<br />

032 An illegal value is specified for the file name buffer byte length; legal values<br />

are from 1 to 12.<br />

033 The input I/O buffer address is NULL; this buffer must be provided when<br />

reading to an SDF file or element.<br />

034 The SDF data record or control record read exceeds the maximum allowed<br />

length of an SDF record.<br />

0100 An unrecognized error has occurred in the SDFI routine. The SDFI error code<br />

is returned in the SUB_STATUS field.<br />

0101 An unrecognized error has occurred in an ACD subroutine. The ACD error<br />

code is returned in the SUB_STATUS field.<br />

0102 An unrecognized error has occurred in executing ER SYMB$. The SYMB$<br />

error code is returned in the SUB_STATUS field.<br />

0103 An incorrect SDFI packet version is being used. The correct SDFI packet<br />

version is returned in the SUB_STATUS field.<br />

0104 An incorrect ER SYMB$ packet version is being used. The correct SYMB$<br />

packet version is returned in the SUB_STATUS field.<br />

A CALL_STATUS code of 0100 or greater is a SAR$ internal error.<br />

The READ procedure I/O status codes listed in Table 17–4 may be returned to the caller<br />

in the IO_STATUS field of the READ packet.<br />

Table 17–4. SAR$: READ Procedure IO_STATUS Status List<br />

Octal Code Status<br />

0 Normal I/O status.<br />

01 to 40 See Table C–2, I/O Status Codes, ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for<br />

an explanation of the I/O status codes.<br />

7833 1733–004 17–19


SAR$ READ<br />

17.2. READ Function/MASM Interface<br />

The SAR$ READ procedures can be called directly from MASM. The SAR$ data<br />

structure definitions and procedure calls are defined by MASM procedures (PROCs).<br />

The element SAR$PROCS contains these PROCs.<br />

17.2.1. READ Packet and Data Area Description<br />

The SAR$ READ function requires a READ packet and data area for the open-input, read,<br />

and close-input calls. The S$ARRPDEF PROC generates the EQUFs defining the READ<br />

packet fields. The word length of the MASM READ packet and data area is at label<br />

SR$PKTWLEN defined by the S$ARRPDEF PROC (the current length is 72 words).<br />

17.2.1.1. Required Information for READ Procedures<br />

The calling program must set the following fields of the READ packet to appropriate<br />

values:<br />

SR$PKTVER<br />

The READ packet data structure version. The current version is equal to the label<br />

SR$CURVER defined by the S$ARRPDEF PROC. SR$PKTVER must not be modified<br />

between calls to the SAR$ READ routine.<br />

SR$FIPADDR<br />

The address of the input file information packet. This packet is supplied by the caller<br />

(see 16.1). Set this field to zero if input is from the runstream.<br />

SR$INPBUF<br />

The address of the input buffer, used to read images from the input file or element.<br />

This field is defined only if input is from an SDF file or element. It is omitted if input<br />

is from the runstream or an alternate READ$ file. Subsection 16.1.2 describes the<br />

input buffer.<br />

SR$INPBUFL<br />

The length in words of the input buffer. It must be of length 28 * dpf * n, where dpf<br />

is the disk prepping factor and n is a positive integer. This field is defined only if<br />

input is from an SDF file or element. It is omitted if input is from the runstream or<br />

an alternate READ$ file.<br />

SR$IMGBUF<br />

The address of the input image buffer into which SAR$ places individual images<br />

from the input buffer. Subsection 16.1.2 describes the image buffer.<br />

17–20 7833 1733–004


SR$IMGBUFL<br />

The length in words of the input image buffer.<br />

SR$TEXBUF<br />

SAR$ READ<br />

The address of the input text buffer into which SAR$ places the character text of the<br />

image read. Subsection 16.1.2 describes the text buffer.<br />

SR$TEXBUFL<br />

The length in 9-bit bytes of the input text buffer.<br />

SR$ATTRIB<br />

The address of the input attribute table, into which SAR$ places the attributes<br />

describing the character text of the image read. This field is undefined if the<br />

attribute table word length is zero. Subsection 16.1.2 describes the format of the<br />

attribute table.<br />

SR$ATTRIBL<br />

The length in words of the input attribute table. A length of zero indicates that there<br />

is no input attribute table.<br />

17.2.1.2. Optional Information for READ Procedures<br />

The calling program may optionally set the following fields of the READ packet. The<br />

default values are obtained by zero-filling the READ packet before placing any<br />

information in the packet.<br />

SR$SELLST<br />

The address of the select list that specifies which attributes to return to the caller.<br />

This field is undefined if the select list byte length is zero. Subsection 16.1.2<br />

describes the format of the select list.<br />

SR$SELLSTL<br />

The length in 9-bit bytes of the select list. A length of zero indicates that there is no<br />

select list (default).<br />

7833 1733–004 17–21


SAR$ READ<br />

SR$REQTYPE<br />

The requested type of input.<br />

0<br />

1<br />

SR$LNUMFMT<br />

Do not search for embedded shift-coded kanji in ASCII/ISO (default).<br />

Search for any embedded shift-coded kanji in ASCII/ISO input, and convert it into<br />

internal format (text part and attributes part). Subsection 16.2 describes internal<br />

format.<br />

The format of line numbers returned by SAR$ to the caller.<br />

0<br />

1<br />

2<br />

3<br />

Use the input line number type read with the input image; it may be either a CTS<br />

or fractional line number (see 1 and 2 below). If no line number exists for the<br />

input image, SAR$ increments the last line number by 1. If the input contains<br />

mixed line number types (SR$LNUMTYP), the line number will be compared to<br />

the previous line number, and if necessary, incremented. If the input does not<br />

have any line numbers, SAR$ generates sequential line numbers with initial<br />

value 1 and increment value 1 (default).<br />

SAR$ generates sequential CTS line numbers with an initial value of 10 and<br />

increment value of 10.<br />

SAR$ generates sequential fractional line numbers with an initial value of 10 and<br />

an increment value of 10.<br />

No line numbers are returned to caller.<br />

17–22 7833 1733–004


SR$UNTRFLG<br />

The untranslate mode flag setting.<br />

0<br />

1<br />

SR$SDFCNTL<br />

SAR$ READ<br />

Untranslate mode is off: an error is returned if SAR$ reads a character set type<br />

other than 00 (Fieldata), 01 (ASCII/ISO), 077 (ACD) (default), or ASCII-like.<br />

Untranslate mode is on: all input is passed to the caller untranslated.<br />

This field specifies which SDF control records to return to the caller. Bits 0 to 31<br />

may be set by the caller, where bit 0 is the leftmost bit of the field. If bit n is set, the<br />

control record type (n + 040) is returned to the caller. The image control word of the<br />

control record is returned in SR$SDFICW, and any data words of the control record<br />

are returned in the text buffer. If this field is set to zero, no control records are<br />

returned to the caller (default).<br />

Note that the control record type 051 is not returned unless it is used to continue a<br />

type 061 control record. Therefore, it is suggested that the caller specify that type<br />

051 records be returned if type 061 records are desired, and vice-versa.<br />

SR$ADDRSEC<br />

The mass storage sector address of the next image to be read. This field is used if<br />

the image to be read is not the next sequential image. If this field is set to zero, the<br />

next sequential image is read (default). It is undefined if the input is not from an SDF<br />

file or element. This field contains SR$ADDRWO in S1 of the word.<br />

SR$ADDRWO<br />

The word offset into the mass storage sector address of the next image to be read.<br />

This field is used if the image to be read is not the next sequential image. If this<br />

field is set to zero, the next sequential image is read (default). This field is undefined<br />

if the input is not from an SDF file or element.<br />

17.2.1.3. Information Returned by READ Procedures<br />

The following fields of the READ packet contain values returned to the calling program<br />

by the SAR$ READ procedures.<br />

SR$STATUS<br />

The READ function status word; it contains the call status in H2, the substatus in T1,<br />

and the I/O status in S3.<br />

7833 1733–004 17–23


SAR$ READ<br />

SR$CALLST<br />

The status code of the current open-input, read, or close-input function calls. See<br />

Table 17–6 for an explanation of the octal status codes.<br />

SR$IOSTAT<br />

The status of any I/O operations performed by the READ procedures. See<br />

Table 17–7 for the octal status codes.<br />

SR$SYMBST<br />

The status word returned from an ER SYMB$ request. See the SYMB$ section of<br />

the Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further details on the SYMB$<br />

status word.<br />

SR$RECBUFL<br />

The recommended buffer or table length when an invalid length is specified or when<br />

an overflow occurs.<br />

SR$TEXTLEN<br />

The length in 9-bit bytes of the character text returned in the text buffer.<br />

SR$NUMATTR<br />

The number of attributes returned in the attribute table.<br />

SR$CHARTYP<br />

The character set type of the image returned to the caller:<br />

0 Fieldata 6-bit characters<br />

01 ASCII/ISO 9-bit characters<br />

077 Attributed character data (ACD)<br />

A value of any ASCII-like character set type defined in Table H–1.<br />

If SR$UNTRFLG is zero (untranslate mode off), then any Fieldata images read are<br />

translated to ASCII/ISO before they are returned to the caller. See 17.3 for details on<br />

allowed input character set types.<br />

SR$INCHARTYP<br />

The character set type of the image in the source input file or element. Contains the<br />

code type from the last 050 or 042 control record encountered in the input file or<br />

element.<br />

17–24 7833 1733–004


SR$IMGSEC<br />

SAR$ READ<br />

The mass storage sector address of the SDF image read. This field is undefined if<br />

input is from the runstream or an alternate READ$ file. SR$IMGWO is contained in<br />

S1 of this field.<br />

SR$IMGWO<br />

The word offset into the mass storage sector address of the SDF image read. This<br />

field is undefined if input is from the runstream or an alternate READ$ file.<br />

SR$LNUMTYP<br />

The type of line number returned with the image read:<br />

0<br />

1<br />

2<br />

SR$LNUMINT<br />

No line number was read from the input; an SAR$ generated line number is<br />

returned. See SR$LNUMFMT in 17.2.1.2.<br />

A CTS line number is returned.<br />

A fractional line number is returned.<br />

The line number returned by SAR$. It may be a CTS line number, the integer part of<br />

a fractional line number, or a generated sequential line number (see SR$LNUMTYP).<br />

SR$LNUMF1<br />

The first 10 digits of the fractional part of a fractional line number. This field is<br />

defined only if SR$LNUMTYP is 2.<br />

SR$LNUMF2<br />

The second 10 digits of the fractional part of a fractional line number. This field is<br />

defined only if SR$LNUMTYP is 2.<br />

SR$LNUMF3<br />

The third 10 digits of the fractional part of a fractional line number. This field is<br />

defined only if SR$LNUMTYP is 2.<br />

SR$LNUMF4<br />

The fourth 10 digits of the fractional part of a fractional line number. This field is<br />

defined only if SR$LNUMTYP is 2.<br />

7833 1733–004 17–25


SAR$ READ<br />

SR$SDFICW<br />

The image control word for the SDF record read. This field is defined only if input is<br />

from an SDF file or element. If bit 1 of SR$SDFICW is set, the image is a control<br />

record. If bit 1 of SR$SDFICW is clear, the image is a data record. Bit 1 is the<br />

leftmost bit of the field. See the Data Structures <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong><br />

for further information on System Data Format (SDF) image control words.<br />

SR$ICWTYPE<br />

If the image is a control record, this field contains the control record type. If the<br />

image is a data record, this field is undefined.<br />

SR$ICWLEN<br />

If the image is a control record, this field contains the length in words of the control<br />

record. If the image is a data record, this field is undefined.<br />

SR$ICWCHAR<br />

This field contains the image character set type, if applicable for this control record<br />

or data record.<br />

17.2.1.4. READ Packet Definition PROC<br />

The PROC S$ARRPDEF generates the EQUFs to define the READ packet. The calling<br />

program may optionally attach an X-register and a B-register to these EQUFs. This<br />

allows the calling program to allocate storage space for the READ packet either statically<br />

at assembly time or dynamically at execution time. The calling program may display the<br />

EQUF labels by setting the display-flag parameter on the PROC call. This PROC also<br />

generates EQUs defining the READ packet current version and word length at labels<br />

SR$CURVER and SR$PKTWLEN, respectively.<br />

Calling Format<br />

S$ARRPDEF x-reg,b-reg,dispflg<br />

Parameters<br />

x-reg<br />

b-reg<br />

The X-register to be attached to the READ packet EQUFs. If x-reg is omitted, no<br />

X register is attached to the EQUFs.<br />

The B-register to be attached to the READ packet EQUFs. If it is omitted, no<br />

B register is attached to the EQUFs.<br />

17–26 7833 1733–004


dispflg<br />

A flag to display a table of the READ packet EQUFs. If it is set to ‘D’, the field<br />

names are displayed; otherwise the field names are not displayed.<br />

Example<br />

$ASCII<br />

$INCLUDE ‘MAXR$’<br />

S$ARRPDEF X9,B2,’D’<br />

SAR$ READ<br />

The PROC call S$ARRPDEF of this example generates EQUFs using registers X9 and B2<br />

and displays a description of each packet field.<br />

17.2.2. Buffers and Tables for MASM READ Procedures<br />

All buffers and tables must be provided by the calling program. The recommended<br />

lengths for the buffers and tables are equated to labels in the S$ARRPDEF PROC.<br />

These lengths and labels are listed in Table 17–5. These definitions simplify the creation<br />

of required buffers and tables for the calling program.<br />

Table 17–5. SAR$: MASM READ Buffer and Table Lengths<br />

Label Value<br />

SR$INPBUFDL (Input buffer word length) 448<br />

SR$IMGBUFDL (Image buffer word length) 63<br />

SR$TEXBUFDL (Text buffer byte length) 132<br />

SR$ATTRIBDL (Attribute table word length) 40<br />

SR$SELLSTDL (Select list byte length) 4<br />

17.2.3. READ Procedures Called from MASM<br />

The MASM procedures for the READ function are<br />

• S$AROPENI (open input)<br />

• S$ARREAD (read)<br />

• S$ARCLOSI (close input)<br />

The calling sequences for these procedures are generated by MASM PROCs, contained<br />

in the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or SYS$*RLIB$.<br />

7833 1733–004 17–27


SAR$ READ<br />

17.2.3.1. Open-Input Procedure Call (S$AROPENI)<br />

The READ packet and data area must be initialized before any images are read. The<br />

S$AROPENI PROC performs the READ packet initialization.<br />

Initial Conditions<br />

The calling program sets the following parameters in the READ packet to appropriate<br />

values before calling S$AROPENI:<br />

• Required parameters (described in 17.2.1.1)<br />

SR$PKTVER<br />

SR$INPBUFL<br />

SR$FIPADDR<br />

SR$IMGBUF<br />

SR$INPBUF<br />

SR$IMGBUFL<br />

• Optional parameters (described in 17.2.1.2)<br />

SR$SELLST<br />

SR$UNTRFLG<br />

SR$SELLSTL<br />

SR$LNUMFMT<br />

SR$REQTYPE<br />

SR$SDFCNTL<br />

Calling Format<br />

S$AROPENI rpkt<br />

error return<br />

normal return<br />

where rpkt is a label identifying the starting address of the READ packet and data area.<br />

Note: It is recommended that the calling program zero-fill the READ packet before<br />

placing any parameters in the packet.<br />

Returns<br />

If the error return from S$AROPENI is taken, A1 contains the call status code, A2<br />

contains the I/O status code, and A3 contains the substatus code. These status codes<br />

are also returned in the packet fields SR$CALLST, SR$IOSTAT, and T1 of SR$STATUS,<br />

respectively. See 17.2.4 for an explanation of the status codes.<br />

If the normal return from S$AROPENI is taken, the initialization of the READ packet is<br />

successful.<br />

17–28 7833 1733–004


17.2.3.2. Read Procedure Call (S$ARREAD)<br />

SAR$ READ<br />

The S$ARREAD PROC returns one image from the symbolic input to the calling program,<br />

placing the character text in the text buffer and the attributes in the attribute table.<br />

Initial Conditions<br />

The calling program sets the following parameters in the READ packet to appropriate<br />

values before calling S$ARREAD:<br />

• Required parameters (described in 17.2.1.1)<br />

SR$TEXBUF<br />

SR$ATTRIBL<br />

SR$TEXBUFL<br />

SR$ATTRIB<br />

• Optional parameters (described in 17.2.1.2)<br />

SR$ADDRSEC<br />

SR$SELLSTL<br />

SR$ADDRWO<br />

SR$SELLST<br />

Calling Format<br />

S$ARREAD rpkt<br />

error return<br />

end-of-file return<br />

normal return<br />

where rpkt is a label identifying the starting address of the READ packet and data area.<br />

Returns<br />

Each call to S$ARREAD reads one image from the input. If the normal return is taken,<br />

S$ARREAD returns the character text in the text buffer, the attributes in the attribute<br />

table, and other information in the READ packet. S$ARREAD does not space-fill the text<br />

buffer if the text length is shorter than the text buffer length. If the text length is longer<br />

than the text buffer, S$ARREAD truncates the text to the length of the text buffer and<br />

takes the error return. See 17.2.1.3 for a list of the fields that contain information<br />

returned by S$ARREAD to the calling program.<br />

If the error return from S$ARREAD is taken, A1 contains the call status code, A2<br />

contains the I/O status code, and A3 contains the substatus code. These status codes<br />

are also returned in the packet fields SR$CALLST, SR$IOSTAT, and T1 of SR$STATUS,<br />

respectively. See 17.2.4 for an explanation of the status codes.<br />

If the end-of-file return from S$ARREAD is taken, the last read request encountered an<br />

end-of-file condition. A1 contains the call status code, A2 contains the I/O status code,<br />

and A3 contains the substatus code. These status codes are also returned in the packet<br />

fields SR$CALLST, SR$IOSTAT, and T1 of SR$STATUS, respectively.<br />

7833 1733–004 17–29


SAR$ READ<br />

17.2.3.3. Close-Input Procedure Call (S$ARCLOSI)<br />

The S$ARCLOSI PROC closes the input operation.<br />

Calling Format<br />

S$ARCLOSI rpkt<br />

error return<br />

normal return<br />

where rpkt is a label identifying the starting address of the READ packet and data area.<br />

Returns<br />

If the error return from S$ARCLOSI is taken, A1 contains the call status code, A2<br />

contains the I/O status code, and A3 contains the substatus code. These status codes<br />

are also returned in the packet fields SR$CALLST, SR$IOSTAT, and T1 of SR$STATUS,<br />

respectively. See 17.2.4 for an explanation of the status codes.<br />

If the normal return from S$ARCLOSI is taken, the input is successfully closed.<br />

17.2.4. Status Lists for MASM READ Procedures<br />

The READ procedure call status codes listed in Table 17–6 may be returned to the calling<br />

program in the SR$CALLST field of the READ packet. These call status codes are for<br />

SR$CURVER = 3 and above.<br />

Table 17–6. SAR$: READ Procedure SR$CALLST Status Codes<br />

Octal Code Status<br />

0 Normal return from SAR$.<br />

01 End-of-file condition reached by S$ARREAD.<br />

02 An I/O error has occurred in a READ procedure. See the SR$IOSTAT field for<br />

the status code and Table 17–7.<br />

03 An outdated READ packet version is being used.<br />

04 An invalid READ packet version is being used.<br />

05 An invalid value is specified for SR$LNUMFMT.<br />

06 The value for SR$IMGBUF is zero; an address must be given for the input<br />

image address.<br />

07 The value for SR$IMGBUFL is zero; a length must be given for the input image<br />

address.<br />

010 An invalid value is specified for SR$REQTYPE.<br />

011 An invalid value is specified for SR$UNTRFLG.<br />

17–30 7833 1733–004


Table 17–6. SAR$: READ Procedure SR$CALLST Status Codes<br />

Octal Code Status<br />

012 The value for SR$INPBUFL is too small; use the word length returned in<br />

SR$RECBUFL.<br />

013 The input file or element accessed is not SDF.<br />

014 An invalid value is specified in the FIP$ACTYP field of the file information<br />

packet.<br />

SAR$ READ<br />

015 An invalid address is specified in SR$ADDRSEC; either the word offset is<br />

greater than 27 or the sector address is greater than the highest mass storage<br />

sector address of the file.<br />

016 The input image is too long to fit in the image buffer. The image buffer word<br />

length necessary to hold the entire image is returned in the field<br />

SR$RECBUFL. To reread the image, call SAR$ READ with a larger image<br />

buffer and image buffer word length (SR$IMGBUFL) and set the read address<br />

(SR$ADDRSEC and SR$ADDRWO) to the image address (SR$IMGSEC and<br />

SR$IMGWO) returned on the previous call.<br />

017 The character text is too long to fit in the text buffer and has been truncated.<br />

The text buffer byte length necessary to hold the character text is returned in<br />

the field SR$RECBUFL.<br />

020 The number of attributes is too large to fit in the attribute table. The attribute<br />

table word length necessary to hold all the attributes is returned in the field<br />

SR$RECBUFL.<br />

021 A partial image was read by SYMB$; call S$ARREAD again to continue reading<br />

the image.<br />

022 An invalid SDF file or element label control record was read.<br />

023 An invalid SDF control read was read.<br />

024 The image read contains incorrectly formatted ACD or incorrectly formatted<br />

embedded shift-coded kanji.<br />

025 An invalid character set type was read.<br />

026 The READ packet is not initialized; a call to S$AROPENI must be made before<br />

calls to S$ARREAD or S$ARCLOSI.<br />

027 An incorrect ACD subroutine version is being used with SAR$.<br />

030 The file name buffer address in the FIP is zero; an address of an SDF file name<br />

must be specified.<br />

031 The file name buffer address in the FIP is zero; an address of a symbiont file<br />

name must be specified.<br />

032 An illegal value is specified for the file name buffer byte length; legal values are<br />

from 1 to 12.<br />

033 The input I/O buffer address is zero; this buffer must be provided when<br />

reading from an SDF file or element.<br />

7833 1733–004 17–31


SAR$ READ<br />

Table 17–6. SAR$: READ Procedure SR$CALLST Status Codes<br />

Octal Code Status<br />

034 The SDF data record or control record read exceeds the maximum allowed<br />

length of an SDF record.<br />

0100 An unrecognized error has occurred in the SDFI routine. The SDFI error code<br />

is returned in T1 of the SR$STATUS field.<br />

0101 An unrecognized error has occurred in an ACD subroutine. The ACD error<br />

code is returned in T1 of the SR$STATUS field.<br />

0102 An unrecognized error has occurred in executing ER SYMB$. The SYMB$<br />

error code is returned in T1 of the SR$STATUS field.<br />

0103 An incorrect SDFI packet version is being used. The correct SDFI packet<br />

version is returned in T1 of the SR$STATUS field.<br />

0104 An incorrect ER SYMB$ packet version is being used. The correct SYMB$<br />

packet version is returned in T1 of the SR$STATUS field.<br />

A SR$CALLST status code of 0100 or greater is a SAR$ internal error.<br />

The READ procedure I/O status codes listed in Table 17–7 may be returned to the caller<br />

in the SR$IOSTAT field of the READ packet.<br />

Table 17–7. SAR$: READ Procedure SR$IOSTAT Status Codes<br />

Status code Explanation<br />

0 Normal I/O status<br />

01 to 40 See Table C–2, I/O Status Codes, Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

17–32 7833 1733–004


SAR$ READ<br />

17.3. <strong>Support</strong>ed Character Set Types for the READ<br />

Function<br />

Table H–1 lists 64 character set types defined for the OS 2200 system. Forty of these<br />

are referred to as ASCII-like. This means that the character set is essentially identical to<br />

the ASCII/ISO character set in the octal range 000 through 01777, with any differences<br />

being minor. Table H–1 identifies the character set types that are ASCII-like.<br />

Throughout this section, wherever ASCII or ASCII/ISO is used, the SAR$ capabilities<br />

apply equally to all ASCII-like character sets.<br />

The following character set types may be read from input files:<br />

• Fieldata 6-bit characters<br />

• ASCII-like characters, including ASCII/ISO 9-bit characters and ASCII/ISO 9-bit<br />

characters with embedded shift-coded kanji<br />

• Attributed character data (ACD)<br />

17.3.1. Fieldata<br />

If the input images are in the Fieldata character set, they are translated to the ASCII/ISO<br />

character set before they are returned to the caller. The translated images are returned<br />

to the caller in the text buffer. No attributes are returned to the caller.<br />

17.3.2. ASCII/ISO and ASCII-like<br />

If the input images are in the ASCII/ISO character set, they are returned to the caller in<br />

the text buffer. No attributes are returned to the caller.<br />

7833 1733–004 17–33


SAR$ READ<br />

17.3.3. ASCII/ISO with Embedded Shift-Coded Kanji<br />

If the input images contain embedded shift-code bytes and REQUEST_TYPE is<br />

S'Translate_embedded_KANJI' (for PLUS) or SR$REQTYPE is 1 (for MASM), the READ<br />

procedures remove the embedded shift-code bytes and return the images in internal<br />

format. The character text is returned in the text buffer, and the attributes are returned<br />

in the attribute table. Subsection 16.2 describes internal format.<br />

If REQUEST_TYPE is S'Pass_embedded_KANJI' (for PLUS) or SR$REQTYPE is 0<br />

(for MASM), the READ procedures do not remove the embedded shift-code bytes.<br />

The entire image is returned untranslated in the text buffer.<br />

Multiple Block Sequence Indicator<br />

If the input images are from a card reader file created by the Nippon-go Preprocessors<br />

for ASCII COBOL (NCOB) and ASCII FORTRAN (NFTN), they may contain a logical record<br />

that is divided into two or more physical records. The record is divided because these<br />

processors run on EXEC level 38R5 or lower levels that do not allow more than 132<br />

characters in a record. To read one logical record rather than two or more physical<br />

records, the multiple block sequence indicator is set in the last shift code of a record.<br />

The records must reside in a symbiont file, and the text buffer must be at least 264<br />

characters long.<br />

17.3.4. Attributed Character Data<br />

If the input images are attributed character data (ACD), the READ procedures translate<br />

the images into internal format. The text part is returned in the text buffer, and the<br />

attributes are returned in the attribute table. Subsection 16.2 describes internal format.<br />

The Data Structures <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> describes ACD format.<br />

17–34 7833 1733–004


Section 18<br />

SAR$ WRITE<br />

18.1. WRITE Function/PLUS Interface<br />

The SAR$ WRITE function writes symbolic images to SDF files, SDF elements, and<br />

symbiont files (PRINT$, PUNCH$, alternate PRINT$, and alternate PUNCH$). If an SDF<br />

element is written to, the element is added to the program file table of contents when<br />

the WRITE operation is completed (by calling SAR_CLOSE_OUTPUT).<br />

The SAR$ WRITE function procedures can be called from PLUS. These procedures are<br />

• SAR_OPEN_OUTPUT<br />

• SAR_WRITE<br />

• SAR_WRITE_CONTROL<br />

• SAR_CLOSE_OUTPUT<br />

All SAR$ data structure definitions and procedure calls are contained in definition<br />

elements. These elements are obtained with the PLUS COPY statement.<br />

Empty symbiont output files may not be created by simply calling SAR_OPEN_OUTPUT<br />

followed by SAR_CLOSE_OUTPUT. An empty symbiont file may be created by setting<br />

IMAGE_CONTROL_WIDTH to a nonzero value when calling SAR_OPEN_OUTPUT,<br />

followed by a call to SAR_CLOSE_OUTPUT. This will cause a print control image to be<br />

generated, which will open the output file. If IMAGE_CONTROL_WIDTH is zero when<br />

creating an "empty" symbiont file, an error will occur during SAR_CLOSE_OUTPUT.<br />

18.1.1. WRITE Packet Data Structure Description<br />

The SAR$ WRITE function requires a WRITE packet data structure for the<br />

SAR_OPEN_OUTPUT, SAR_WRITE, SAR_WRITE_CONTROL, and<br />

SAR_CLOSE_OUTPUT procedure calls.<br />

The type definition for this data structure is contained in the element SAR$WPKTD in the<br />

<strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or SYS$*RLIB$. It is obtained with the COPY<br />

statement. The identifier for the WRITE packet data structure type is<br />

SAR_WRITE_PACKET.<br />

7833 1733–004 18–1


SAR$ WRITE<br />

The calling program must provide storage space for the WRITE packet data structure<br />

plus any necessary buffers and tables since SAR$ does not have any D-bank storage.<br />

The length of the WRITE packet is equal to the constant<br />

SAR_WRITE_PACKET_WORD_LENGTH defined in the element SAR$WPKTD (current<br />

length is 36 words). SAR_WRITE_PACKET is defined as LOCATABLE.<br />

The calling program places information in the WRITE packet data structure and passes<br />

the address of the WRITE packet data structure to SAR$ as a parameter on the<br />

procedure calls.<br />

18.1.1.1. Required Information for WRITE Procedures<br />

The calling program must set the following fields of the WRITE packet to an appropriate<br />

value:<br />

PACKET_VERSION<br />

PLUS Attribute: 6-bit integer<br />

The WRITE packet data structure version. The current version is equal to the<br />

constant SAR_WRITE_PACKET_CURRENT_VERSION defined in the element<br />

SAR$WPKTD.<br />

OUTPUT_FILE_INFO_PKT_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the output file information packet. This packet is supplied by the<br />

caller (see 18.1.2). Set to NULL if OUTPUT_FILE_TYPE is S'PRINT_File',<br />

S'PUNCH_File', or S'No_Output'.<br />

OUTPUT_BUFFER_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the output buffer, used to write images to the output file or element.<br />

This field is defined only if output is to an SDF file or element. It is omitted if output<br />

is to a symbiont file. Subsection 18.1.2 describes the output buffer.<br />

OUTPUT_BUFFER_WORD_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in words of the output buffer. It must be of length 28 * dpf * n, where<br />

dpf is the disk prepping factor and n is a positive integer. This field is defined only if<br />

output is to an SDF file or element. It is omitted if output is to a symbiont file.<br />

18–2 7833 1733–004


IMAGE_BUFFER_ADDRESS<br />

PLUS Attribute: word pointer<br />

SAR$ WRITE<br />

The address of the output image buffer, into which SAR$ places the images to be<br />

written out. Subsection 18.1.2 describes the image buffer.<br />

IMAGE_BUFFER_WORD_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in words of the output image buffer.<br />

TEXT_BUFFER_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the output text buffer, into which the caller places the character text<br />

to be written out. Subsection 18.1.2 describes the text buffer.<br />

TEXT_BUFFER_BYTE_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in 9-bit bytes of the character text in the text buffer.<br />

ATTRIBUTE_TABLE_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the output attribute table, into which the caller places the attributes<br />

describing the character text to be output. This field is undefined if the<br />

ATTRIBUTE_TABLE_WORD_LENGTH is zero. Subsection 18.1.2 describes the<br />

format of the attribute table.<br />

ATTRIBUTE_TABLE_WORD_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The number of valid entries in the attribute table. (Each entry is one word.) A value<br />

of zero indicates there is no output attribute table.<br />

SDF_IMAGE_CONTROL_WORD<br />

PLUS Attribute: word logical<br />

If OUTPUT_RECORD_TYPE is S'Control_record', the caller must place the SDF<br />

image control word in this field and place any data words of the control record in the<br />

output text buffer. Otherwise, this field is omitted.<br />

7833 1733–004 18–3


SAR$ WRITE<br />

18.1.1.2. Optional Information for WRITE Procedures<br />

The calling program may optionally set the following fields of the WRITE packet.<br />

The default values are obtained by zero-filling the WRITE packet before placing any<br />

information in the packet.<br />

OUTPUT_FILE_TYPE<br />

PLUS Attribute: 6-bit status<br />

The file type that output images are written to:<br />

S'SDF_element'<br />

Write to an SDF element (default).<br />

S'SDF_file'<br />

Write to an SDF file.<br />

S'PRINT_file'<br />

Write to the standard PRINT$ file.<br />

S'PUNCH_file'<br />

Write to the standard PUNCH$ file.<br />

S'Alternate_PRINT_file'<br />

Write to an alternate PRINT$ file.<br />

S'Alternate_PUNCH_file'<br />

Write to an alternate PUNCH$ file.<br />

S'No_output'<br />

Construct the output image in the image buffer, but do not write it out.<br />

The output file may not be a tape file.<br />

18–4 7833 1733–004


OUTPUT_RECORD_TYPE<br />

PLUS Attribute: 6-bit status<br />

The type of record to be written;<br />

S'Data_record'<br />

SDF data record for SDF files or elements (default).<br />

S'Control_record'<br />

SDF control record for SDF files or elements.<br />

S'Symbiont_record'<br />

Data record for symbiont files.<br />

S'Write_control_record'<br />

Write control record for symbiont files.<br />

OUTPUT_LINE_NUMBER_TYPE<br />

PLUS Attribute: 6-bit status<br />

The type of line numbers used for the output images:<br />

S'No_line_numbers'<br />

No line numbers are written out (default).<br />

S'Generate_fractional'<br />

SAR$ WRITE<br />

Generate sequential fractional line numbers with initial value 10 and increment<br />

value 10.<br />

S'Generate_CTS'<br />

Generate sequential CTS line numbers with initial value 10 and increment value<br />

10.<br />

S'Fractional_in_packet'<br />

Output the fractional line numbers supplied by the caller in the packet.<br />

S'CTS_in_packet'<br />

Output the CTS line numbers supplied by the caller in the packet.<br />

7833 1733–004 18–5


SAR$ WRITE<br />

OUTPUT_IMAGE_CHARACTER_TYPE<br />

PLUS Attribute: 6-bit status<br />

The character set type to be output by SAR$:<br />

S'ASCII_ISO'<br />

S'ACD'<br />

ASCII/ISO 9-bit characters (default) and all other ASCII-like types in Table H–1.<br />

Attributed character data (ACD).<br />

A value of any ASCII-like character set type in Table H–1.<br />

Other character set types may not be written out by SAR$. See 18.3 for details on<br />

the allowed output character set types.<br />

INPUT_TEXT_CHARACTER_TYPE<br />

PLUS Attribute: 6-bit status<br />

If the character set type of the text placed in the text buffer is Fieldata, this field<br />

must be set to S'Fieldata'. Otherwise, this field is set to S'ASCII_ISO' (default). The<br />

WRITE procedure converts Fieldata to ASCII/ISO before it is written out.<br />

UNTRANSLATE_MODE<br />

PLUS Attribute: 6-bit status<br />

The untranslate mode flag setting:<br />

S'Off'<br />

S'On'<br />

An error is returned if character set types other than ASCII/ISO, ACD, or ASCIIlike<br />

are specified for output (default).<br />

Character set types other than ASCII/ISO, ACD, or ASCII-like are written to the<br />

output file untranslated. This is set to output Fieldata.<br />

18–6 7833 1733–004


GENERAL_SDF_LABEL_FLAG<br />

PLUS Attribute: 6-bit status<br />

SAR$ WRITE<br />

A flag controlling the generation of the SDF file or element label control record:<br />

S'On'<br />

S'Off'<br />

If output is to an SDF file or element, write out a label control record with<br />

general file type 'S' (default).<br />

Do not write out an SDF label control record. If output is to an SDF file or<br />

element, the caller must write this record.<br />

CLOSING_BREAKPOINT_FLAG<br />

PLUS Attribute: 6-bit status<br />

A flag controlling symbiont file closing breakpoints:<br />

S'On'<br />

S'Off'<br />

If output is to alternate symbiont file filename, execute an '@BRKPT filename'<br />

command when SAR_CLOSE_OUTPUT is called (default).<br />

Do not execute an '@BRKPT filename' command.<br />

OUTPUT_IMAGE_LINE_SPACING<br />

PLUS Attribute: 18-bit integer<br />

For symbiont file output, the number of lines to space before printing the image<br />

(default is 1).<br />

ELEMENT_CREATION_DATE_AND_TIME<br />

PLUS Attribute: word logical<br />

For SDF element output, the creation date and time of the element to be entered in<br />

the program file table of contents. The date and time format is described under<br />

"Program File Format," in the Data Structures <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>. The<br />

default is the current date and time when SAR_CLOSE_OUTPUT is called.<br />

7833 1733–004 18–7


SAR$ WRITE<br />

LINE_NUMBER_INTEGER_PART<br />

PLUS Attribute: word integer<br />

The line number to be written out with the output image. It may be a CTS line<br />

number or the integer part of a fractional line number (see<br />

OUTPUT_LINE_NUMBER_TYPE). This field is used only for output types of SDF<br />

files or SDF elements.<br />

LINE_NUMBER_FRACTIONAL_PART (1:4)<br />

PLUS Attribute: word integer<br />

The fractional part of a fractional line number to be written out with the output<br />

image. Each word contains 10 digits of the fraction. This field is used only for<br />

output types of SDF files or SDF elements.<br />

TRIM_BLANKS_FLAG<br />

PLUS Attribute: 6-bit status<br />

A flag that determines if words of blank (space) characters are trimmed from the end<br />

of ASCII output images before they are written out:<br />

S'Off'<br />

S'On'<br />

Do not trim blank characters (default).<br />

Trim blank characters from output image.<br />

IMAGE_CONTROL_WIDTH<br />

PLUS Attribute: 18-bit integer<br />

The initial print or punch control width of the output file. The default is 33 words<br />

(132 ASCII characters). This field is used only for symbiont output file types. This is<br />

only recognized during the SAR_OPEN_OUTPUT call. If it is modified in subsequent<br />

calls to SAR_WRITE, it will be ignored. If the output file type is a symbiont file,<br />

SAR$ may expand the line width if necessary. The line width will be reset to the<br />

print or punch device default in SAR_CLOSE_OUTPUT. This is to allow for the<br />

additional bytes required in the ASCII/ISO with embedded shift-coded kanji and ACD<br />

character types and for transmitting large data records such as a full screen of<br />

characters.<br />

The constant SAR_PCW_CHARS_PER_WORD may be used to calculate the desired<br />

IMAGE_CONTROL_WIDTH.<br />

18–8 7833 1733–004


18.1.1.3. Information Returned by WRITE Procedures<br />

SAR$ WRITE<br />

The following fields of the WRITE packet contain values returned by the SAR$ WRITE<br />

procedures to the calling program:<br />

CALL_STATUS<br />

PLUS Attribute: 18-bit status<br />

The status of the current call to SAR_OPEN_OUTPUT, SAR_WRITE,<br />

SAR_WRITE_CONTROL, or SAR_CLOSE_OUTPUT. See Table 18–3 for an<br />

explanation of the WRITE procedure status codes. This field may be referenced as<br />

an 18-bit logical field with the label CALL_STATUS_CODE.<br />

SUB_STATUS_CODE<br />

PLUS Attribute: 12-bit logical<br />

This field contains additional information for particular CALL_STATUS codes.<br />

IO_STATUS<br />

PLUS Attribute: 6-bit status<br />

The status of any I/O operations performed by SAR$. See Table 18–4 for the I/O<br />

status codes. This field may be referenced as a 6-bit logical field with the label<br />

IO_STATUS_CODE.<br />

WRITE_STATUS_WORD<br />

PLUS Attribute: word logical<br />

A one-word combination of CALL_STATUS, SUB_STATUS, and IO_STATUS<br />

contained in H2, T1, and S3, respectively.<br />

SYMB_STATUS_WORD<br />

PLUS Attribute: word logical<br />

The status word returned from an ER SYMB$ request. See SYMB$ section, OS<br />

2200 Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further details on the ER SYMB$<br />

status word.<br />

RECOMMENDED_BUFFER_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The recommended buffer or table length when an invalid length is specified or when<br />

an overflow occurs.<br />

7833 1733–004 18–9


SAR$ WRITE<br />

IMAGE_BYTE_LENGTH<br />

PLUS Attribute: 18-integer<br />

The length in bytes of the image written out by the SAR_WRITE procedure. For<br />

images written to SDF files or elements, the length does not include the image<br />

control word or the length of the line number records. For images written to<br />

symbiont files, the length is the number of bytes transferred by the SYMB$ request.<br />

IMAGE_ADDRESS_SECTOR<br />

PLUS Attribute: 24-bit integer<br />

The mass storage sector address to which the SDF image was written. This field is<br />

undefined if output file type is not an SDF file or element. If a line number control<br />

record (type 053) is written with the data record, this address is the sector address<br />

of the line number control record corresponding to the data record.<br />

IMAGE_ADDRESS_WORD_OFFSET<br />

PLUS Attribute: 6-bit integer<br />

The word offset into the mass storage sector address that the SDF image was<br />

written to. This field is undefined if output file type is not an SDF file or element.<br />

IMAGE_ADDRESS<br />

PLUS Attribute: word machine integer<br />

A one word combination of IMAGE_ADDRESS_SECTOR and<br />

IMAGE_ADDRESS_WORD_OFFSET, contained in bits 13 to 36 and in bits 1 to 6,<br />

respectively. (Bit 1 is the leftmost bit of the word.)<br />

18.1.2. Buffers and Tables for PLUS WRITE Procedures<br />

The SAR$ WRITE function requires that the following buffers and table be supplied by<br />

the calling program:<br />

• Output buffer<br />

The output buffer is used to write to mass storage files. The calling program never<br />

needs to access the output buffer, but it must provide it to SAR$. If the calling<br />

program is using both the READ and WRITE functions of SAR$, then it cannot use<br />

the same I/O buffer for both functions. The calling program must provide a separate<br />

input and output buffer for each function.<br />

18–10 7833 1733–004


SAR$ WRITE<br />

• Image buffer<br />

The image buffer is used to construct individual images from information in the text<br />

buffer and attribute table and move them into the output buffer. Because images<br />

can be written in different formats, this buffer is necessary to relieve the calling<br />

program from having to build these formats. The calling program never needs to<br />

access the image buffer, but it must provide it to SAR$. The calling program using<br />

the READ and WRITE functions of SAR$ can use the same image buffer for both<br />

functions.<br />

• Text buffer<br />

The text buffer is used to pass the characters of the output image to SAR$. The<br />

calling program must place the characters sequentially in the text buffer, regardless<br />

of the eventual output format or attributes that may apply to the characters. The<br />

text buffer is one part of internal format (see 16.2). The calling program using the<br />

READ and WRITE functions of SAR$ can use the same text buffer for both<br />

functions.<br />

• Attribute table<br />

The attribute table is used to pass to SAR$ the attributes that apply to the characters<br />

in the text buffer. Each attribute has a one-word entry in the attribute table which<br />

follows the format in Figure 18–1.<br />

index type value<br />

0 17 18 26 27 35<br />

Figure 18–1. SAR$: Attribute Table Entry<br />

The calling program places the attribute entries into the attribute table. The attribute<br />

table is the other part of internal format (see 16.2). If the output images will not<br />

contain any attributes or if UNTRANSLATE_MODE is set to S (on), the attribute table<br />

may be omitted by setting ATTRIBUTE_TABLE_ADDRESS to null (zero). The calling<br />

program using the READ and WRITE functions of SAR$ can use the same attribute<br />

table for both functions.<br />

All buffers and tables must be provided by the calling program. The type definitions for<br />

the buffers and tables and definitions for the default buffer and table lengths are<br />

contained in the element SAR$DEFN in the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or<br />

SYS$*RLIB$. They may be obtained with the COPY statement. These definitions<br />

simplify the creation of required buffers and tables for the calling program.<br />

7833 1733–004 18–11


SAR$ WRITE<br />

The default buffer and table lengths are listed in Table 18–1.<br />

Table 18–1. SAR$: PLUS WRITE Buffer and Table<br />

Length Defaults<br />

Identifier Value<br />

SAR_IO_BUFFER_WORD_LENGTH 448<br />

SAR_IMAGE_BUFFER_WORD_LENGTH 63<br />

SAR_TEXT_BUFFER_BYTE_LENGTH 132<br />

SAR_ATTRIBUTE_TABLE_WORD_LENGTH 40<br />

The buffer and table type definitions are listed in Table 18–2.<br />

Table 18–2. SAR$: PLUS WRITE Buffer and Table<br />

Type Definitions<br />

Identifier Type<br />

SAR_IO_BUFFER 448 words logical locatable<br />

SAR_IMAGE_BUFFER 63 words logical locatable<br />

SAR_TEXT_BUFFER 132 ASCII characters locatable<br />

SAR_ATTRIBUTE_TABLE 40 words logical locatable<br />

SAR_SELECT_LIST 4 bytes logical locatable<br />

The element SAR$DEFN also contains other definitions necessary to SAR$.<br />

18.1.3. WRITE Procedures Called from PLUS<br />

The procedures for the WRITE function are<br />

• SAR_OPEN_OUTPUT<br />

• SAR_WRITE<br />

• SAR_WRITE_CONTROL<br />

• SAR_CLOSE_OUTPUT<br />

The procedure declarations for SAR_OPEN_OUTPUT, SAR_WRITE,<br />

SAR_WRITE_CONTROL, and SAR_CLOSE_OUTPUT are contained in the element<br />

SAR$WRITE$DG in the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or SYS$*RLIB$. This element is<br />

obtained with the COPY statement. SAR$WRITE$DG contains all four procedure<br />

declarations. All of the WRITE procedure modules are compiled with the G option using<br />

the IBJ$ calling sequence.<br />

18–12 7833 1733–004


18.1.3.1. SAR_OPEN_OUTPUT Procedure Call<br />

SAR$ WRITE<br />

The WRITE packet data structure must be initialized before any images are written out.<br />

The SAR_OPEN_OUTPUT procedure performs the WRITE packet initialization.<br />

Initial Conditions<br />

The calling program sets the following parameters in the WRITE packet to appropriate<br />

values before calling SAR_OPEN_OUTPUT:<br />

• Required parameters (described in 18.1.1.1)<br />

PACKET_VERSION<br />

OUTPUT_FILE_INFO_PACKET_ADDRESS<br />

OUTPUT_BUFFER_ADDRESS<br />

OUTPUT_BUFFER_WORD_LENGTH<br />

IMAGE_BUFFER_ADDRESS<br />

IMAGE_BUFFER_WORD_LENGTH<br />

• Optional parameters (described in 18.1.1.2)<br />

OUTPUT_FILE_TYPE<br />

OUTPUT_LINE_NUMBER_TYPE<br />

OUTPUT_IMAGE_CHARACTER_TYPE<br />

UNTRANSLATE_MODE<br />

GENERAL_SDF_LABEL_FLAG<br />

CLOSING_BREAKPOINT_FLAG<br />

TRIM_BLANKS_FLAG<br />

IMAGE_CONTROL_WIDTH<br />

Note: The calling program must zero-fill the WRITE packet before placing any<br />

parameters in the packet.<br />

Calling Format<br />

PROCEDURE SAR_OPEN_OUTPUT<br />

(WRITE_PACKET_ADDRESS: WORD MACHINE POINTER)<br />

IMPORTED ('SAR$OPENO$PG');<br />

Returns<br />

SAR_OPEN_OUTPUT returns the initialization status in the WRITE packet field<br />

CALL_STATUS. If the status is S'Normal', the initialization of the WRITE packet is<br />

successful. Otherwise, an error has occurred and CALL_STATUS contains the status<br />

code. See 18.1.4 for a list of WRITE function status codes.<br />

7833 1733–004 18–13


SAR$ WRITE<br />

18.1.3.2. SAR_WRITE Procedure Call<br />

The SAR_WRITE procedure writes images to the output file or element. Each call to<br />

SAR_WRITE writes out one image. The calling program must supply the character text<br />

of the image in the text buffer and the attributes for the text (if any) in the attribute table.<br />

SAR_WRITE combines the text and attributes into the proper format and writes out the<br />

image.<br />

Initial Conditions<br />

The calling program sets the following parameters in the WRITE packet to appropriate<br />

values before calling SAR_WRITE:<br />

• Required parameters (described in 18.1.1.1)<br />

TEXT_BUFFER_ADDRESS<br />

TEXT_BUFFER_BYTE_LENGTH<br />

ATTRIBUTE_TABLE_ADDRESS<br />

ATTRIBUTE_TABLE_WORD_LENGTH<br />

• Optional parameters (described in 18.1.1.2)<br />

OUTPUT_RECORD_TYPE<br />

INPUT_TEXT_CHARACTER_TYPE<br />

OUTPUT_IMAGE_LINE_SPACING<br />

LINE_NUMBER_INTEGER_PART<br />

LINE_NUMBER_FRACTIONAL_PART(1:4)<br />

Calling Format<br />

PROCEDURE SAR_WRITE<br />

(WRITE_PACKET_ADDRESS: WORD MACHINE POINTER)<br />

IMPORTED ('SAR$WRITE$PG');<br />

Returns<br />

SAR_WRITE returns the calling status in the WRITE packet field CALL_STATUS. If the<br />

status is S'Normal', then the write was successful. The following fields of the WRITE<br />

packet contain information returned by SAR$ to the calling program:<br />

IMAGE_BYTE_LENGTH<br />

IMAGE_ADDRESS_SECTOR<br />

IMAGE_ADDRESS_WORD_OFFSET<br />

These parameters are described in 18.1.1.3.<br />

If the status returned from SAR_WRITE is not S'Normal', then an error has occurred and<br />

CALL_STATUS contains the status code. See 18.1.4 for a list of WRITE function status<br />

codes.<br />

18–14 7833 1733–004


18.1.3.3. SAR_WRITE_CONTROL Procedure Call<br />

SAR$ WRITE<br />

The SAR_WRITE_CONTROL procedure performs the following write control functions<br />

for symbiont files:<br />

• Moves to the top of the next page<br />

• Moves to logical line n<br />

• Inserts a heading at the top of all succeeding pages<br />

• Clears the heading from the top of all succeeding pages<br />

• Sets the page length, top margin, bottom margin, and lines per inch<br />

Initial Conditions<br />

The calling program sets the following parameters in the WRITE packet to appropriate<br />

values before calling SAR_WRITE_CONTROL:<br />

• Required parameter (described below)<br />

CONTROL_FUNCTION<br />

• Optional parameters (described below)<br />

LINE_NUMBER_ON_PAGE<br />

PAGE_LENGTH<br />

TOP_MARGIN_LENGTH<br />

BOTTOM_MARGIN_LENGTH<br />

LINES_PER_INCH<br />

Calling Format<br />

PROCEDURE SAR_WRITE_CONTROL<br />

(WRITE_PACKET_ADDRESS: WORD MACHINE POINTER)<br />

IMPORTED ('SAR$WCNTL$PG');<br />

Parameters<br />

CONTROL_FUNCTION<br />

PLUS Attribute: 18-bit status<br />

The WRITE control function to be performed by SAR_WRITE_CONTROL:<br />

S'Top_of_page'<br />

Move to the top of the next page (page eject).<br />

S'Line_spacing'<br />

Space to line n on the page, where n is the value set by the calling program in<br />

the field LINE_NUMBER_ON_PAGE. If the current line location is equal to or<br />

beyond n, space to line n of the next page.<br />

7833 1733–004 18–15


SAR$ WRITE<br />

S'Print_heading'<br />

Insert a heading at the top of all succeeding pages. The heading text must be in<br />

the ASCII/ISO character set with a maximum length of 96 characters. The caller<br />

places the heading text in the text buffer, and the length of the heading text in<br />

the field TEXT_BUFFER_BYTE_LENGTH.<br />

S'Clear_heading'<br />

Clear the heading from the top of all succeeding pages.<br />

S'Set_margins'<br />

Change the values for the page length, top margin, bottom margin, and lines per<br />

inch. The values are set by the caller in fields PAGE_LENGTH,<br />

TOP_MARGIN_LENGTH, BOTTOM_MARGIN_LENGTH, and LINES_PER_INCH.<br />

A value of -1 for any of these fields results in the device standard value being<br />

used.<br />

LINE_NUMBER_ON_PAGE<br />

PLUS Attribute: 18-bit integer<br />

The logical line number on the page to space to. This field is defined only for the<br />

CONTROL_FUNCTION S'Line_spacing'.<br />

PAGE_LENGTH<br />

PLUS Attribute: 18-bit signed integer<br />

The number of lines in a page. This field is defined only for the<br />

CONTROL_FUNCTION S'Set_margins'.<br />

TOP_MARGIN_LENGTH<br />

PLUS Attribute: 18-bit signed integer<br />

The number of blank lines used for a top margin; it must be less than 63 lines.<br />

This field is defined only for the CONTROL_FUNCTION S'Set_margins'.<br />

BOTTOM_MARGIN_LENGTH<br />

PLUS Attribute: 18-bit signed integer<br />

The number of blank lines used for a bottom margin; it must be less than 63 lines.<br />

This field is defined only for the CONTROL_FUNCTION S'Set_margins'.<br />

18–16 7833 1733–004


LINES_PER_INCH<br />

PLUS Attribute: 18-bit signed integer<br />

SAR$ WRITE<br />

The number of lines per inch; it may be 6, 8, or -1 (device standard value). This field<br />

is defined only for the CONTROL_FUNCTION S'Set_margins'.<br />

Returns<br />

SAR_WRITE_CONTROL returns the calling status in the WRITE packet field<br />

CALL_STATUS. If the status is S'Normal', then the write control operation was<br />

successful.<br />

If the status returned from SAR_WRITE_CONTROL is not S'Normal', then an error has<br />

occurred and CALL_STATUS contains the status code. See 18.1.4 for a list of WRITE<br />

function status codes.<br />

18.1.3.4. SAR_CLOSE_OUTPUT Procedure Call<br />

The SAR_CLOSE_OUTPUT procedure performs the necessary tasks to close the output<br />

operation. If the output type is an SDF element, the element is added to the program<br />

file table of contents.<br />

Initial Condition<br />

The calling program may set the following optional parameter in the WRITE packet to an<br />

appropriate value before calling SAR_CLOSE_OUTPUT:<br />

ELEMENT_CREATION_DATE_AND_TIME<br />

This parameter is described in 18.1.1.2.<br />

Calling Format<br />

PROCEDURE SAR_CLOSE_OUTPUT<br />

(WRITE_PACKET_ADDRESS: WORD MACHINE POINTER)<br />

IMPORTED ('SAR$CLOSO$PG');<br />

Returns<br />

SAR_CLOSE_OUTPUT returns the calling status in the WRITE packet field<br />

CALL_STATUS. If the status is S'Normal', then the close was successful.<br />

If the status returned from SAR_CLOSE_OUTPUT is not S'Normal', then an error has<br />

occurred and CALL_STATUS contains the status code. See 18.1.4 for a list of WRITE<br />

function status codes.<br />

7833 1733–004 18–17


SAR$ WRITE<br />

18.1.3.5. Example<br />

The following example shows a PLUS program using SAR$ WRITE to write SDF output:<br />

COPY (‘SAR$DEFN’);<br />

COPY (‘SAR$WPKTD’);<br />

COPY (‘SAR$FILEPKTD’);<br />

DECLARE WRITE_PKT: SAR_WRITE_PACKET,<br />

IO_BUF: SAR_IO_BUFFER,<br />

IMAGE_BUF: SAR_IMAGE_BUFFER,<br />

TEXT_BUF: SAR_TEXT_BUFFER,<br />

ATTRIBUTE_TBL: SAR_ATTRIBUTE_TABLE,<br />

FILE_PKT: SAR_FILE_INFO_PACKET;<br />

COPY (‘SAR$WRITE$DG’);<br />

.<br />

.<br />

.<br />

WRITE_PKT.PACKET_VERSION:= SAR_WRITE_PACKET_CURRENT_VERSION;<br />

WRITE_PKT.OUTPUT_FILE_INFO_PACKET_ADDRESS:= LOC(FILE_PKT);<br />

WRITE_PKT.OUTPUT_BUFFER_ADDRESS:= LOC(IO_BUF);<br />

WRITE_PKT.OUTPUT_BUFFER_WORD_LENGTH:= SAR_IO_BUFFER_WORD_LENGTH;<br />

WRITE_PKT.IMAGE_BUFFER_ADDRESS:= LOC(IMAGE_BUF);<br />

WRITE_PKT.IMAGE_BUFFER_WORD_LENGTH:= SAR_IMAGE_BUFFER_WORD_LENGTH;<br />

WRITE_PKT.TEXT_BUFFER_ADDRESS:= LOC(TEXT_BUF);<br />

WRITE_PKT.TEXT_BUFFER_BYTE_LENGTH:= SAR_TEST_BUFFER_BYTE_LENGTH;<br />

WRITE_PKT.ATTRIBUTE_TABLE_ADDRESS:= LOC(ATTRIBUTE_TBL);<br />

WRITE_PKT.ATTRIBUTE_TABLE_WORD_LENGTH:= SAR_ATTRIBUTE_TABLE_WORD_LENGTH;<br />

.<br />

.<br />

.<br />

SAR_OPEN_OUTPUT(LOC(WRITE_PKT));<br />

IF WRITE_PKT.CALL_STATUS NE S ‘Normal’<br />

THEN BEGIN<br />

PROCESS_WRITE_ERROR;<br />

RETURN;<br />

END;<br />

.<br />

.<br />

.<br />

SAR_WRITE(LOC(WRITE_PKT));<br />

IF WRITE_PKT.CALL_STATUS NE S’Normal’<br />

THEN BEGIN<br />

PROCESS_WRITE_ERROR;<br />

RETURN;<br />

END;<br />

.<br />

.<br />

.<br />

SAR_CLOSE_OUPUT(LOC(WRITE_PKT));<br />

IF WRITE_PKT.CALL_STATUS NE S ‘Normal’<br />

THEN BEGIN<br />

PROCESS_WRITE_ERROR;<br />

RETURN;<br />

END;<br />

18–18 7833 1733–004


SAR$ WRITE<br />

In this example, the COPY statement obtains the SAR$ definitions for the buffers and<br />

tables, WRITE packet, WRITE procedure, and file information packet.<br />

The SAR$ data structures for the WRITE function are declared by using the definitions<br />

contained in element SAR$DEFN, SAR$WPKTD, and SAR$FILEPKTD.<br />

The WRITE packet is initialized by assigning appropriate values to all necessary fields.<br />

All other WRITE packet fields take the default values if the WRITE packet is zero-filled.<br />

The SAR_WRITE_PACKET_CURRENT_VERSION constant is defined in the SAR$WPKTD<br />

element, and the buffer length constants are defined in the SAR$DEFN element.<br />

The WRITE function is initialized by calling the SAR_OPEN_OUTPUT procedure, passing<br />

the WRITE packet address as a parameter. If the CALL_STATUS field of the WRITE<br />

packet is not status S'Normal', the error is processed. The SAR_WRITE procedure is<br />

called to write each SDF image out to the file or element described in the file information<br />

packet.<br />

When all images are written out, the SAR_CLOSE_OUTPUT procedure is called. This<br />

procedure writes an end-of-file record, and if the output is to an element, adds the<br />

element to the program file table of contents.<br />

18.1.4. Status Lists for PLUS WRITE Procedures<br />

The WRITE procedure call status codes listed in Table 18–3 may be returned to the<br />

calling program in the CALL_STATUS field of the WRITE packet. These CALL_STATUS<br />

codes are for SAR_WRITE_PACKET_CURRENT_VERSION = 2 and above. A list of all call<br />

status codes is available as WRITE_CALL_STATUS_LIST, an 18-bit status data entity<br />

defined in the element SAR$WPKTD.<br />

Table 18–3. SAR$: WRITE Procedure CALL_STATUS Codes<br />

Octal Code Status<br />

0 Normal return from SAR$.<br />

01 An outdated WRITE packet version is being used.<br />

02 An invalid WRITE packet version is being used.<br />

03 The value for IMAGE_BUFFER_ADDRESS is NULL; an address must be<br />

given for the output image buffer.<br />

04 The IMAGE_BUFFER_WORD_LENGTH is zero; a length must be given for<br />

the output image buffer.<br />

05 The value for OUTPUT_FILE_INFO_PKT_ADDRESS is NULL; a file<br />

information packet must be given for this output file type.<br />

06 An invalid value is specified for OUTPUT_FILE_TYPE.<br />

07 An invalid value is specified for OUTPUT_LINE_NUMBER_TYPE.<br />

010 An invalid value is specified for UNTRANSLATE_MODE.<br />

7833 1733–004 18–19


SAR$ WRITE<br />

Table 18–3. SAR$: WRITE Procedure CALL_STATUS Codes<br />

Octal Code Status<br />

011 The value for OUTPUT_BUFFER_WORD_LENGTH is too small; use the word<br />

length returned in RECOMMENDED_BUFFER_LENGTH.<br />

012 An I/O error has occurred in a WRITE procedure. See the IO_STATUS_CODE<br />

field for the status code and Table 18–4.<br />

013 An invalid value is specified for OUTPUT_RECORD_TYPE.<br />

014 An incorrect ACD subroutine version is being used with SAR$.<br />

015 The attribute table contains an index that is either zero, not in sequential<br />

order, or greater than the text length.<br />

016 The attribute table contains an invalid attribute type or an invalid value for the<br />

attribute type.<br />

017 An illegal character set type is specified for the<br />

OUTPUT_IMAGE_CHARACTER_TYPE.<br />

020 Line numbers are not allowed for this output file type.<br />

021 The WRITE packet is not initialized; a call to SAR_OPEN_OUTPUT must be<br />

made before calls to SAR_WRITE, SAR_WRITE_CONTROL, or<br />

SAR_CLOSE_OUTPUT.<br />

022 The image buffer has overflowed; use the word length in<br />

RECOMMENDED_BUFER_LENGTH for IMAGE_BUFFER_WORD_LENGTH<br />

and call SAR_WRITE again.<br />

024 An error has occurred in adding the element to the table of contents; see the<br />

SUB_STATUS_CODE field for the ER PFI$ status code and the Exec ER<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

026 An error has occurred in executing the symbiont file closing breakpoint; see<br />

the SUB_STATUS_CODE field for the ER CSF$ status code returned for<br />

@SYM and @BRKPT in dynamically submitted control statements in the Exec<br />

ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

027 SDF control records cannot be written to this output file type.<br />

030 Symbiont write control records cannot be written to this output file type.<br />

031 The file name buffer address in the FIP is NULL; an address of an SDF file<br />

name must be specified.<br />

032 The file name buffer address in the FIP is NULL; an address of a symbiont file<br />

name must be specified.<br />

033 The element name buffer address in the FIP is NULL; an address of an SDF<br />

element name must be specified.<br />

034 An illegal value is specified for the file name buffer byte length; legal values<br />

are from 1 to 12.<br />

035 An illegal value is specified for the element name buffer byte length; legal<br />

values are from 1 to 12.<br />

036 An illegal value is specified for the version name buffer byte length; legal<br />

values are from 1 to 12.<br />

18–20 7833 1733–004


Table 18–3. SAR$: WRITE Procedure CALL_STATUS Codes<br />

Octal Code Status<br />

SAR$ WRITE<br />

037 The output I/O buffer address is NULL; this buffer must be provided when<br />

writing to an SDF file or element.<br />

0100 An unrecognized error has occurred in the SDFO routine. The SDFO error<br />

code is returned in the SUB_STATUS field.<br />

0101 An unrecognized error has occurred in an ACD subroutine. The ACD error<br />

code is returned in the SUB_STATUS field.<br />

0102 An unrecognized error has occurred in executing ER SYMB$. The SYMB$<br />

error code is returned in the SUB_STATUS field.<br />

0103 An incorrect SDFO packet version is being used. The correct SDFO packet<br />

version is returned in the SUB_STATUS field.<br />

0104 An incorrect ER SYMB$ packet version is being used. The correct SYMB$<br />

packet version is returned in the SUB_STATUS field.<br />

A CALL_STATUS code of 0100 or greater is an SAR$ internal error.<br />

The WRITE procedure I/O status codes listed in Table 18–4 may be returned to the<br />

calling program in the IO_STATUS field of the WRITE packet.<br />

Table 18–4. SAR$: WRITE Procedure IO_STATUS Status List<br />

Octal Code Status<br />

0 Normal I/O status.<br />

01 to 040 See Table C–2, I/O Status Codes, Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong><br />

for an explanation of the I/O status codes.<br />

18.2. WRITE Function/MASM Interface<br />

The SAR$ write function writes symbolic images to SDF files, SDF elements, and<br />

symbiont files (PRINT$, PUNCH$, alternate PRINT$, and alternate PUNCH$). If an SDF<br />

element is written to, the element is added to the program file table of contents when<br />

the WRITE operation is completed (by calling S$ARCLOSO).<br />

The SAR$ WRITE procedures can be called directly from MASM. The SAR$ data<br />

structure definitions and procedure calls are defined by MASM procedures (PROCs).<br />

The element SAR$PROCS contains these PROCs.<br />

7833 1733–004 18–21


SAR$ WRITE<br />

Empty symbiont output files may not be created by simply calling S$AROPENO followed<br />

by S$ARCLOSO. An empty symbiont file may be created by setting SW$PCW to a<br />

nonzero value when calling S$AROPENO, followed by a call to S$ARCLOSO. This will<br />

cause a print control image to be generated, which will open the output file. If SW$PCW<br />

is zero when creating an "empty" symbiont file, an error will occur during S$ARCLOSO.<br />

18.2.1. WRITE Packet and Data Area Description<br />

The SAR$ write function requires a WRITE packet and data area for the open-output,<br />

write, and close-output calls. The S$ARWPDEF PROC generates the EQUFs defining<br />

the packet fields. The word length of the MASM WRITE packet and data area is equal to<br />

label SW$PKTWLEN defined by the S$ARWPDEF PROC (the current length is 70<br />

words).<br />

18.2.1.1. Required Information for WRITE Procedures<br />

The calling program must set the following fields of the WRITE packet to appropriate<br />

values:<br />

SW$PKTVER<br />

The WRITE packet data structure version. The current version is equal to the label<br />

SW$CURVER, defined by the S$ARWPDEF PROC.<br />

SW$FIPADDR<br />

The address of the output file information packet. This packet is supplied by the<br />

caller (see 16.1). Set this field to zero if SW$OUTFILT is 2, 3, or 6.<br />

SW$OUTBUF<br />

The address of the output buffer used to write images to the output file or element.<br />

This field is defined only if output is to an SDF file or element. It is omitted if output<br />

is to a symbiont file. Subsection 15.6.2 describes the output buffer.<br />

SW$OUTBUFL<br />

The length in words of the output buffer. It must be of length (28 * dpf * n), where<br />

dpf is the disk prepping factor and n is a positive integer. This field is defined only if<br />

output is to an SDF file or element. It is omitted if output is to a symbiont file.<br />

SW$IMGBUF<br />

The address of the output image buffer into which the SAR$ places the images to be<br />

written out. Subsection 15.6.2 describes the image buffer.<br />

SW$IMGBUFL<br />

The length in words of the output image buffer.<br />

18–22 7833 1733–004


SW$TEXBUF<br />

SAR$ WRITE<br />

The address of the output text buffer, into which the caller places the character text<br />

to be written out. Subsection 15.6.2 describes the text buffer.<br />

SW$TEXBUFL<br />

The length in 9-bit bytes of the character text in the text buffer.<br />

SW$ATTRIB<br />

The address of the output attribute table into which the caller places the attributes<br />

describing the character text to be output. This field is undefined if the<br />

SW$ATTRIBL field is set to zero. Subsection 15.6.2 describes the format of the<br />

attribute table.<br />

SW$ATTRIBL<br />

The number of valid entries in the attribute table (each entry is one word.) A value of<br />

zero indicates there is no output attribute table.<br />

SW$SDFICW<br />

If the SW$OUTRECT field is set to 1 (SDF control record), the caller must place the<br />

SDF image control word in this field, and place any data words of the control record<br />

in the output text buffer.<br />

18.2.1.2. Optional Information for WRITE Procedures<br />

The calling program may optionally set the following fields of the WRITE packet. The<br />

default values are obtained by zero-filling the WRITE packet before placing any<br />

information in the packet.<br />

SW$OUTFILT<br />

The file type that output images are written to:<br />

0 Write to an SDF element (default).<br />

1 Write to an SDF file.<br />

2 Write to the standard PRINT$ file.<br />

3 Write to the standard PUNCH$ file.<br />

4 Write to an alternate PRINT$ file.<br />

5 Write to an alternate PUNCH$ file.<br />

6 Construct the output image in the image buffer, but do not write it out.<br />

The output file may not be a tape file.<br />

7833 1733–004 18–23


SAR$ WRITE<br />

SW$OUTRECT<br />

The type of record to be written:<br />

0 SDF data record for SDF files or elements (default).<br />

1 SDF control record for SDF files or elements.<br />

2 Data record for symbiont files.<br />

3 Write control record for symbiont files.<br />

SW$LNUMFMT<br />

The format of line numbers used for output images:<br />

0<br />

1<br />

2<br />

3<br />

4<br />

SW$OCHART<br />

No line numbers are to be written out (default).<br />

Generate sequential fractional line numbers with initial value 10 and increment<br />

value 10.<br />

Generate sequential CTS line numbers with initial value 10 and increment value<br />

10.<br />

Output the fractional line numbers supplied by the caller in the packet.<br />

Output the CTS line numbers supplied by the caller in the packet.<br />

The character set type to be output by SAR$<br />

0 ASCII/ISO 9-bit characters (default), including ASCII-like characters in Table H–1.<br />

1 Attributed character data (ACD).<br />

Other character set types may not be written out by SAR$. See 18.3 for details on<br />

the allowed output character set types.<br />

18–24 7833 1733–004


SW$ICHART<br />

SAR$ WRITE<br />

If the character set type of the text placed in the text buffer is Fieldata, this field<br />

must be set to 1. Otherwise this field is set to 2 (ASCII/ISO–default). SAR$<br />

converts Fieldata to ASCII/ISO before it is written out.<br />

SW$UNTRFLG<br />

The untranslate mode flag setting:<br />

0<br />

1<br />

SW$SDFLBLF<br />

An error is returned if character set types other than ASCII/ISO, ACD, or ASCIIlike<br />

are specified for output (default).<br />

Character set types other than ASCII/ISO, ACD, or ASCII-like are written to the<br />

output file untranslated.<br />

A flag controlling the generation of the SDF file or element label control record<br />

0<br />

1<br />

SW$BRKPTF<br />

If output is to an SDF file or element, write out a label control record with<br />

general file type 'S' (default).<br />

Do not write out an SDF label control record. If output is to an SDF file or<br />

element, the caller must write this record.<br />

A flag controlling symbiont file closing breakpoints:<br />

0<br />

1<br />

SW$LINESPA<br />

If output is to alternate symbiont file filename, execute a '@BRKPT filename'<br />

command when the close-output procedure is called (default).<br />

Do not execute a '@BRKPT filename' command.<br />

For symbiont file output, the number of lines to space before writing the image<br />

(default is 1).<br />

7833 1733–004 18–25


SAR$ WRITE<br />

SW$ELTCDT<br />

For SDF element output, the creation date and time of the element to be entered in<br />

the program file table of contents. The date and time format is described under<br />

"Program File Format," Data Structures <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>. The default<br />

is the current date and time when the close-output procedure is called.<br />

SW$LNUMINT<br />

The line number to be written out with the output image. It may be a CTS line<br />

number or the integer part of a fractional line number (see SW$LNUMFMT). This<br />

field is used only for output types of SDF files and SDF elements.<br />

SW$LNUMF1<br />

The first 10 digits of the fractional line number to be written out with the output<br />

image. This field is used only for output types of SDF files and SDF elements.<br />

SW$LNUMF2<br />

The second 10 digits of the fractional line number to be written out with the output<br />

image. This field is used only for output types of SDF files and SDF elements.<br />

SW$LNUMF3<br />

The third 10 digits of the fractional line number to be written out with the output<br />

image. This field is used only for output types of SDF files and SDF elements.<br />

SW$LNUMF4<br />

The fourth 10 digits of the fractional line number to be written out with the output<br />

image. This field is used only for output types of SDF files and SDF elements.<br />

SW$TRIMBF<br />

A flag that determines if words of blank (space) characters are trimmed from the end<br />

of ASCII output images before they are written out.<br />

0 Do not trim blank characters (default).<br />

1 Trim blank characters from ASCII output images.<br />

SW$PCW<br />

The initial print or punch control width of the output file. The default is 33 words<br />

(132 ASCII characters). This field is used only for symbiont output file types. This is<br />

only recognized during the S$AROPENO call. If it is modified in subsequent calls to<br />

S$ARWRITE, it will be ignored. If the output file type is a symbiont file, SAR$ may<br />

expand the line width if necessary. The line width will be reset to the print or punch<br />

device default in the S$ARCLOSO call. This is to allow for the additional bytes<br />

required in the ASCII/ISO with embedded shift-coded kanji and ACD character types<br />

and for transmitting large data records such as a full screen of characters.<br />

18–26 7833 1733–004


18.2.1.3. Information Returned by WRITE Procedures<br />

SAR$ WRITE<br />

The following fields of the WRITE packet contain values returned by the SAR$ WRITE<br />

procedures to the calling program:<br />

SW$STATUS<br />

The WRITE function status word; it contains the call status in H2, the substatus in<br />

T1, and the I/O status in S3 of the word.<br />

SW$CALLST<br />

The status of the current open-output, write, or close-input procedure call. See Table<br />

18–6 for an explanation of the octal status codes.<br />

SW$IOSTAT<br />

The status of any I/O operations performed by SAR$. See Table 18–7 for the octal<br />

status codes.<br />

SW$SYMBDT<br />

The status word returned from an ER SYMB$ request. See the SYMB$ section,<br />

Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further details on the SYMB$ status<br />

word.<br />

SW$RECBUFL<br />

The recommended buffer or table length when an invalid length is specified or when<br />

an overflow occurs.<br />

SW$IMGBLEN<br />

The length in bytes of the image written out by the WRITE procedure. For images<br />

written to SDF files or elements, the length does not include the image control word<br />

or the length of the line number records. For images written to symbiont files, the<br />

length is the number of bytes transferred by the SMB$ request.<br />

SW$IMGSEC<br />

The mass storage sector address that the SDF image was written to. This field is a<br />

full word containing the sector address in S3 to S6 and the field SW$IMGWO in S1.<br />

SW$IMGSEC is undefined if the output file type is not an SDF file or element. If a<br />

line number control record (type 053) is written with the data record, this address is<br />

the sector address of the line number control record corresponding to the data<br />

record.<br />

SW$IMGWO<br />

The word offset into the sector address (SW$IMGSEC) that the SDF image was<br />

written to. This field is contained in S1 of SW$IMGSEC. SW$IMGWO is undefined<br />

if the output file type is not an SDF file or element.<br />

7833 1733–004 18–27


SAR$ WRITE<br />

18.2.1.4. WRITE Packet Definition PROC<br />

The S$ARWPDEF PROC generates the EQUFs to define the WRITE packet. The calling<br />

program may optionally attach an X-register and a B-register to these EQUFs. This<br />

allows the calling program to allocate storage space for the WRITE packet either<br />

statically at assembly time or dynamically at execution time. The calling program may<br />

display the EQUF labels by setting the display-flag parameter on the PROC call. This<br />

PROC also generates EQUs defining the WRITE packet current version and word length<br />

at labels SW$CURVER and SW$PKTWLEN, respectively.<br />

Calling Format<br />

S$ARWPDEF x-reg,b-reg,dispflg<br />

Parameters<br />

x-reg<br />

The X-register to be attached to the WRITE packet EQUFs. If it is omitted, no<br />

X-register is attached to the EQUFs.<br />

b-reg<br />

The B-register to be attached to the WRITE packet EQUFs. If it is omitted, no<br />

B-register is attached to the EQUFs.<br />

dispflg<br />

A flag to display a table of the WRITE packet EQUFs. If it is set to 'D', the field<br />

names are displayed; otherwise, the field names are not displayed.<br />

Example<br />

$ASCII<br />

$INCLUDE ‘MAXR$’<br />

S$ARWPDEF X4,B6,‘D’<br />

The PROC call S$ARWPDEF generates EQUFs using registers X4 and B6 and displays a<br />

description of each packet field.<br />

18–28 7833 1733–004


18.2.2. MASM WRITE Procedures Buffers and Tables<br />

SAR$ WRITE<br />

All buffers and tables must be provided by the calling program. The recommended<br />

lengths for the buffers and tables are equated to labels in the S$ARWPDEF PROC.<br />

These lengths and labels are listed in Table 18–5. These definitions simplify the creation<br />

of required buffers and tables for the calling program.<br />

Table 18–5. SAR$: MASM WRITE Buffer and Table<br />

Lengths<br />

Label Value<br />

SW$OUTBUFDL (Output buffer word length) 448<br />

SW$IMGBUFDL (Image buffer word length) 63<br />

SW$TEXBUFDL (Text buffer byte length) 132<br />

SW$ATTRIBDL (Attribute table word length) 40<br />

18.2.3. WRITE Procedures Called from MASM<br />

The procedures for the WRITE function are<br />

• S$AROPENO (open output)<br />

• S$ARWRITE (write an image)<br />

• S$ARCLOSO (close output)<br />

The calling sequences for these procedures are generated by MASM PROCs, contained<br />

in the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or SYS$*RLIB$.<br />

18.2.3.1. Open-Output Procedure Call (S$AROPENO)<br />

The WRITE packet and data area must be initialized before any images are written out.<br />

The S$AROPENO PROC performs the WRITE packet initialization.<br />

Initial Conditions<br />

The calling program sets the following parameters in the WRITE packet to appropriate<br />

values before calling S$AROPENO:<br />

• Required parameters (described in 18.2.1.1)<br />

SW$PKTVER<br />

SW$OUTBUFL<br />

W$FIPADDR<br />

W$IMGBUF<br />

W$OUTBUF<br />

W$IMGBUFL<br />

7833 1733–004 18–29


SAR$ WRITE<br />

• Optional parameters (described in 18.2.1.2)<br />

SW$OUTFILT<br />

SW$UNTRFLG<br />

SW$TRIMBF<br />

SW$LNUMFMT<br />

SW$SDFLBLF<br />

SW$OCHART<br />

SW$BRKPTF<br />

Note: It is recommended that the calling program zero-fill the WRITE packet before<br />

placing any parameters in the packet.<br />

Calling Format<br />

S$AROPENO wpkt<br />

error return<br />

normal return<br />

where wpkt is a label identifying the starting address of the WRITE packet and data area.<br />

Returns<br />

If S$AROPENO takes the error return, A1 contains the call status code, A2 contains the<br />

I/O status code, and A3 contains the substatus code. These status codes are also<br />

returned in the packet fields SW$CALLST, SW$IOSTAT, and T1 of SW$STATUS,<br />

respectively. See 18.2.4 for an explanation of the status codes.<br />

If S$AROPENO takes the normal return, the initialization of the WRITE packet is<br />

successful.<br />

18.2.3.2. WRITE Procedure Call (S$ARWRITE)<br />

The S$ARWRITE PROC writes images to the output file or element. Each call to<br />

S$ARWRITE writes out one image. The calling program must supply the character text<br />

of the image in the text buffer and the attributes for the text (if any) in the attribute table.<br />

S$ARWRITE combines the text and attributes into the proper format and writes out the<br />

image.<br />

Initial Conditions<br />

The calling program sets the following parameters in the WRITE packet to appropriate<br />

values before calling S$ARWRITE:<br />

• Required parameters (described in 18.2.1.1)<br />

SW$TEXBUF<br />

SW$ATTRIBL<br />

SW$TEXBUFL<br />

SW$ATTRIB<br />

18–30 7833 1733–004


• Optional parameters (described in 18.2.1.2)<br />

SW$OUTRECT<br />

SW$LNUMINT<br />

SW$LNUMF3<br />

SW$ICHART<br />

SW$LNUMF1<br />

SW$LNUMF4<br />

SW$LINESPA<br />

SW$LNUMF2<br />

Calling Format<br />

S$ARWRITE wpkt<br />

error return<br />

normal return<br />

SAR$ WRITE<br />

where wpkt is a label identifying the starting address of the WRITE packet and data area.<br />

Returns<br />

If S$ARWRITE takes the error return, A1 contains the call status code, A2 contains the<br />

I/O status code, and A3 contains the substatus code. These status codes are also<br />

returned in the packet fields SW$CALLST, SW$IOSTAT, and T1 of SW$STATUS,<br />

respectively. See 18.2.4 for an explanation of the status codes.<br />

If S$ARWRITE takes the normal return, the write was successful. The following fields of<br />

the WRITE packet contain information returned by SAR$ to the calling program:<br />

SW$IMGBLEN<br />

SW$IMGSEC<br />

SW$IMGWO<br />

These parameters are described in 18.2.1.3.<br />

Write Control Functions<br />

The calling program may perform write control functions with the S$ARWRITE<br />

procedure call. The calling program sets SW$OUTRECT to 3 (write control record),<br />

places the control image in the text buffer, and calls S$ARWRITE. See "Print Control<br />

Function," Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for details on the control images.<br />

18.2.3.3. Close-Output Procedure Call (S$ARCLOSO)<br />

The S$ARCLOSO PROC performs the necessary tasks to close the output operation.<br />

If the output type is an SDF element, the element is added to the program file table of<br />

contents.<br />

7833 1733–004 18–31


SAR$ WRITE<br />

Initial Condition<br />

The calling program may set the following optional parameter in the WRITE packet to an<br />

appropriate value before calling S$ARCLOSO:<br />

SW$ELTCDT<br />

This parameter is described in 18.2.1.2.<br />

Calling Format<br />

S$ARCLOSO wpkt<br />

error return<br />

normal return<br />

where wpkt is a label identifying the starting address of the WRITE packet and data area.<br />

Returns<br />

If S$ARCLOSO takes the error return, A1 contains the call status code, A2 contains the<br />

I/O status code, and A3 contains the substatus code. These status codes are also<br />

returned in the packet fields SW$CALLST, SW$IOSTAT, and T1 of SW$STATUS,<br />

respectively. See 18.2.4 for an explanation of the status codes.<br />

If S$ARCLOSO takes the normal return, the output is successfully closed.<br />

18.2.4. Status Lists for MASM WRITE Procedures<br />

The WRITE procedure call status codes listed in Table 18–6 may be returned to the<br />

calling program in the SW$CALLST field of the WRITE packet. These call status codes<br />

are for SW$CURVER = 2 or above.<br />

Table 18–6. SAR$: WRITE Procedure SW$CALLST Codes<br />

Octal Code Status<br />

0 Normal return from SAR$.<br />

01 An outdated WRITE packet version is being used.<br />

02 An invalid WRITE packet version is being used.<br />

03 The value for SW$IMGBUF is zero; an address must be given for the output<br />

image buffer.<br />

04 The SW$IMGBUFL is zero; a length must be given for the output image<br />

buffer.<br />

05 The value for SW$FIPADDR is zero; a file information packet must be given<br />

for this output file type.<br />

06 An invalid value is specified for SW$OUTFILT.<br />

07 An invalid value is specified for SW$LNUMFMT.<br />

010 An invalid value is specified for SW$UNTRFLG.<br />

18–32 7833 1733–004


Table 18–6. SAR$: WRITE Procedure SW$CALLST Codes<br />

Octal Code Status<br />

SAR$ WRITE<br />

011 The value for SW$OUTBUFL is too small; use the word length returned in<br />

SW$RECBUFL.<br />

012 An I/O error has occurred in a WRITE procedure. See the SW$IOSTAT field<br />

for the status code and Table 18–7.<br />

013 An invalid value is specified for SW$OUTRECT.<br />

014 An incorrect ACD subroutine version is being used with SAR$.<br />

015 The attribute table contains an index that is either zero, not in sequential<br />

order, or greater than the text length.<br />

016 The attribute table contains an invalid attribute type or an invalid value for the<br />

attribute type.<br />

017 An illegal character set type is specified in the SW$OCHART field.<br />

020 Line numbers are not allowed for this output file type.<br />

021 The WRITE packet is not initialized; a call to S$AROPENO must be made<br />

before calls to S$ARWRITE or S$ARCLOSO.<br />

022 The image buffer has overflowed; use the word length returned in<br />

SW$RECBUFL for the SW$IMGBUFL field and call S$ARWRITE again.<br />

024 An error has occurred in adding the element to the table of contents; see T1<br />

of the SW$STATUS field for the ER PFI$ status code and the Exec ER<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

026 An error has occurred in executing the symbiont file closing breakpoint; see<br />

T1 of the SW$STATUS field for the ER CSF$ status code and the Exec ER<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

027 SDF control records cannot be written to this output file type.<br />

030 Symbiont write control records cannot be written to this output file type.<br />

031 The file name buffer address in the FIP is zero; an address of an SDF file<br />

name must be specified.<br />

032 The file name buffer address in the FIP is zero; an address of a symbiont file<br />

name must be specified.<br />

033 The element name buffer address in the FIP is zero; an address of an SDF<br />

element name must be specified.<br />

034 An illegal value is specified for the file name buffer byte length in the FIP;<br />

legal values are from 1 to 12.<br />

035 An illegal value is specified for the element name buffer byte length in the<br />

FIP; legal values are from 1 to 12.<br />

036 An illegal value is specified for the version name buffer byte length in the FIP;<br />

legal values are from 1 to 12.<br />

037 The output I/O buffer address (SW$OUTBUF) is zero; this buffer must be<br />

provided when writing to an SDF file or element.<br />

7833 1733–004 18–33


SAR$ WRITE<br />

Table 18–6. SAR$: WRITE Procedure SW$CALLST Codes<br />

Octal Code Status<br />

0100 An unrecognized error has occurred in the SDFO routine. The SDFO error<br />

code is returned in the SUB_STATUS field.<br />

0101 An unrecognized error has occurred in an ACD subroutine. The ACD error<br />

code is returned in the SUB_STATUS field.<br />

0102 An unrecognized error has occurred in executing ER SYMB$. The SYMB$<br />

error code is returned in the SUB_STATUS field.<br />

0103 An incorrect SDFO packet version is being used. The correct SDFO packet<br />

version is returned in the SUB_STATUS field.<br />

0104 An incorrect ER SYMB$ packet version is being used. The correct SYMB$<br />

packet version is returned in the SUB_STATUS field.<br />

A SW$CALLST code of 0100 or greater is a SAR$ internal error.<br />

The WRITE procedure I/O status codes listed in Table 18–7 may be returned to the<br />

calling program in the SW$IOSTAT field of the WRITE packet.<br />

Table 18–7. SAR$: WRITE Procedure SW$IOSTAT Status List<br />

Octal Code Status<br />

0 Normal I/O status.<br />

01 to 040 See the Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for an explanation of the<br />

I/O status codes.<br />

18.3. WRITE Function <strong>Support</strong>ed Character Set<br />

Types<br />

Table H–1 lists 64 character set types defined for the OS 2200 system. Forty of these<br />

are referred to as ASCII-like. This means that the character set is essentially identical to<br />

the ASCII/ISO character set in the octal range 000 through 0177, with any differences<br />

being minor. Table H–1 identifies the character set types that are ASCII-like.<br />

Throughout this section, wherever ASCII or ASCII/ISO is used, the SAR$ capabilities<br />

apply equally to all ASCII-like character sets.<br />

The following character set types may be written to output files:<br />

• ASCII-like characters, including ASCII/ISO 9-bit characters and ASCII/ISO 9-bit<br />

characters with embedded shift-coded kanji<br />

• Attributed character data (ACD)<br />

18–34 7833 1733–004


18.3.1. ASCII/ISO and ASCII-like<br />

SAR$ WRITE<br />

If the text to be written out is in the ASCII/ISO character set, it is placed in the text<br />

buffer. An attribute table is not necessary; the attribute table word length is set to zero.<br />

18.3.2. ASCII/ISO with Embedded Shift-Coded Kanji<br />

If the text to be written out already contains the embedded shift-code bytes, it is placed<br />

in the text buffer. An attribute table is not necessary; the attribute table word length is<br />

set to zero.<br />

If the text to be written out is in internal format, the text part is placed in the text buffer,<br />

and the attributes are placed in the attribute table. The WRITE procedure places the<br />

shift-code bytes in the image before it is written out. Subsection 16.2 describes internal<br />

format.<br />

Multiple Block Sequence Indicator<br />

If the multiple block sequence indicator is set in the last shift code of a record, the next<br />

physical record is treated as a part of the current record. A complete record is returned<br />

with the requested attribute table.<br />

18.3.3. Attributed Character Data<br />

The text to be written out must be in internal format. The text part is placed in the text<br />

buffer, and the attributes are placed in the attribute table. The WRITE procedure<br />

constructs the ACD image and writes it out. Subsection 16.2 describes internal format.<br />

The Data Structures <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> describes the ACD format.<br />

7833 1733–004 18–35


SAR$ WRITE<br />

18–36 7833 1733–004


Section 19<br />

SAR$ ATREAD<br />

19.1. ATREAD Function/PLUS Interface<br />

The SAR$ ATREAD function writes a symbolic image to the current output stream and<br />

reads a symbolic image from the current input stream.<br />

The SAR$ ATREAD procedures can be called directly from PLUS. All SAR$ data<br />

structure definitions and procedure calls are contained in definition elements and may be<br />

obtained with the PLUS COPY statement.<br />

19.1.1. ATREAD Packet Data Structure Description<br />

The SAR$ ATREAD function requires an ATREAD packet data structure for the<br />

SAR_INITIALIZE_ATREAD and SAR_ATREAD procedure calls.<br />

The type definition for this data structure is contained in the element SAR$ATRPKTD in<br />

the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or SYS$*RLIB$. It may be obtained with the COPY<br />

statement. The identifier for the ATREAD packet data structure type is<br />

SAR_ATREAD_PACKET.<br />

The calling program must provide storage space for the ATREAD packet data structure,<br />

plus any necessary buffers and tables, since SAR$ does not have any D-bank storage.<br />

The length of the ATREAD packet is equal to the constant<br />

SAR_ATREAD_PACKET_WORD_LENGTH, defined in the element SAR$ATRPKTD<br />

(current length is 29 words). SAR_ATREAD_PACKET is defined as LOCATABLE.<br />

The calling program places information in the ATREAD packet data structure and passes<br />

the address of the data structure to SAR$ through the procedure calls.<br />

7833 1733–004 19–1


SAR$ ATREAD<br />

19.1.1.1. Required Information for ATREAD Procedures<br />

The calling program must set the following fields of the ATREAD packet to appropriate<br />

values:<br />

PACKET_VERSION:<br />

PLUS Attribute: 6-bit integer<br />

The ATREAD packet data structure version. The current version is equal to the<br />

constant SAR_ATREAD_PACKET_CURRENT_VERSION defined in the element<br />

SAR$ATRPKTD.<br />

IMAGE_BUFFER_ADDRESS:<br />

PLUS Attribute: word pointer<br />

The address of the image buffer which ATREAD uses to construct images to be<br />

written out and to read input images into.<br />

IMAGE_BUFFER_WORD_LENGTH:<br />

PLUS Attribute: 18-bit integer<br />

The length in words of the image buffer.<br />

OUTPUT_TEXT_BUFFER_ADDRESS:<br />

PLUS Attribute: word pointer<br />

The address of the output text buffer into which the caller places the character text<br />

to be written out.<br />

OUTPUT_TEXT_BUFFER_BYTE_LENGTH:<br />

PLUS Attribute: 18-bit integer<br />

The length in 9-bit bytes of the character text in the text buffer.<br />

OUTPUT_ATTRIBUTE_TABLE_ADDRESS:<br />

PLUS Attribute: word pointer<br />

The address of the output attribute table into which the caller places the attributes<br />

describing the character text to be output. This field is undefined if the<br />

OUTPUT_ATTRIBUTE_TABLE_WORD_LENGTH is zero.<br />

19–2 7833 1733–004


OUTPUT_ATTRIBUTE_TABLE_WORD_LENGTH:<br />

PLUS Attribute: 18-bit integer<br />

SAR$ ATREAD<br />

The number of valid entries in the attribute table. (Each entry is one word.) A value<br />

of zero indicates there is no output attribute table.<br />

INPUT_TEXT_BUFFER_ADDRESS:<br />

PLUS Attribute: word pointer<br />

The address of the input text buffer into which ATREAD places the character text of<br />

the image read.<br />

INPUT_TEXT_BUFFER_BYTE_LENGTH:<br />

PLUS Attribute: 18-bit integer<br />

The length in 9-bit bytes of the input text buffer.<br />

INPUT_ATTRIBUTE_TABLE_ADDRESS:<br />

PLUS Attribute: word pointer<br />

The address of the input attribute table into which ATREAD places the attributes<br />

describing the character text of the image read. This field is undefined if the<br />

INPUT_ATTRIBUTE_TABLE_WORD_LENGTH is zero.<br />

INPUT_ATTRIBUTE_TABLE_WORD_LENGTH:<br />

PLUS Attribute: 18-bit integer<br />

The length in words of the input attribute table. A length of zero indicates there is no<br />

input attribute table.<br />

19.1.1.2. Optional Information for ATREAD Procedures<br />

The calling program may optionally set the following fields of the ATREAD packet. The<br />

default values are obtained by zero-filling the ATREAD packet before placing any<br />

information in the packet.<br />

OUTPUT_CHARACTER_TYPE<br />

PLUS Attribute: 6-bit status<br />

The character set type of the image to be output by ATREAD:<br />

S'ASCII_ISO' ASCII/ISO 9-bit characters (default).<br />

S'ACD' Attributed character data (ACD).<br />

A value of any ASCII-like character set type in Table H–1.<br />

7833 1733–004 19–3


SAR$ ATREAD<br />

Other character set types may not be written out by SAR$. See18.3 for details on<br />

the allowed output character set types.<br />

OUTPUT_IMAGE_LINE_SPACING<br />

PLUS Attribute: 18-bit integer<br />

The number of lines to space before writing the image (default is 1).<br />

INPUT_SELECT_LIST_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the input select list that specifies which attributes of the input image<br />

to return to the caller. This field is undefined if<br />

INPUT_SELECT_LIST_BYTE_LENGTH is zero.<br />

INPUT_SELECT_LIST_BYTE_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in 9-bit bytes of the input select list. A length of zero indicates there is no<br />

input select list (default).<br />

INPUT_REQUEST_TYPE<br />

PLUS Attribute: 6-bit status<br />

The requested type of input:<br />

S'Pass_embedded_KANJI'<br />

Do not search for embedded shift-coded kanji in ASCII/ISO (default).<br />

S'Translate_embedded_KANJI'<br />

Search for any embedded shift-coded kanji in ASCII/ISO input and convert it into<br />

internal format (text part and attributes part).<br />

PRINT_CONTROL_WIDTH<br />

PLUS Attribute: 18-bit integer<br />

The number of words in which to set the print line width. This value may be<br />

determined by dividing the desired number of columns by the constant<br />

SAR_PCW_CHARS_PER_WORD. This value must be set prior to calling the<br />

SAR_INITIALIZE_ATREAD routine. If this field is not set, the print line width will not<br />

be changed by the SAR_INITIALIZE_ATREAD routine (it may still be changed by the<br />

SAR_ATREAD routine if an image is encountered which is greater than the current<br />

print line width). Following the call to the SAR_INITIALIZE_ATREAD, this field is<br />

used to keep track of the current print line width; therefore, the caller should not<br />

modify this field following the SAR_INITIALIZE_ATREAD routine.<br />

19–4 7833 1733–004


19.1.1.3. Information Returned by ATREAD Procedures<br />

The following fields of the ATREAD packet contain values returned by the SAR$<br />

ATREAD procedures to the calling program:<br />

CALL_STATUS<br />

PLUS Attribute: 18-bit status<br />

SAR$ ATREAD<br />

The status of the current call to SAR_INITIALIZE_ATREAD or SAR_ATREAD. See<br />

Table 19–3 for an explanation of the ATREAD procedure call status codes. This field<br />

may also be referenced as an 18-bit logical field with label CALL_STATUS_CODE.<br />

SUB_STATUS_CODE<br />

PLUS Attribute: 6-bit logical<br />

This field contains additional information for particular CALL_STATUS codes.<br />

IO_STATUS<br />

PLUS Attribute: 6-bit status<br />

The status of any I/O operations performed by the ATREAD procedures. See<br />

Table 19–3 for the I/O status lists. This field may also be referenced as a 6-bit logical<br />

field with label IO_STATUS_CODE.<br />

ATREAD_STATUS_WORD<br />

PLUS Attribute: word logical<br />

A one-word combination of CALL_STATUS, SUB_STATUS, and IO_STATUS<br />

contained in H2, S1, and S3, respectively.<br />

SYMB_STATUS_WORD<br />

PLUS Attribute: word logical<br />

The status word returned from an ER SYMB$ request.<br />

See SYMB$, Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further details on the ER<br />

SYMB$ status word.<br />

RECOMMENDED_BUFFER_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The recommended buffer or table length when an invalid length is specified or when<br />

an overflow occurs.<br />

7833 1733–004 19–5


SAR$ ATREAD<br />

OUTPUT_IMAGE_BYTE_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in bytes of the image written out by SAR_ATREAD.<br />

BYTE_LENGTH_OF_INPUT_TEXT<br />

PLUS Attribute: 18-bit integer<br />

The length in 9-bit bytes of the character text returned in the input text buffer.<br />

NUMBER_OF_INPUT_ATTRIBUTES<br />

PLUS Attribute: 18-bit integer<br />

The number of attributes returned in the input attribute table.<br />

INPUT_CHARACTER_TYPE<br />

PLUS Attribute: 6-bit status<br />

The character set type of the image read:<br />

S'ASCII_ISO' ASCII/ISO 9-bit characters<br />

S'ACD' Attributed character data (ACD)<br />

A value of any ASCII-like character set type defined in Table H–1.<br />

If a Fieldata image is read, it is translated to ASCII/ISO before being returned to the<br />

caller. See 17.3 for details on allowed input character set types.<br />

INPUT_CHARACTER_CODE<br />

PLUS Attribute: 6-bit logical<br />

The character set type of the image read:<br />

01 ASCII/ISO 9-bit characters<br />

077 Attributed character data (ACD)<br />

A value of any ASCII-like character set type defined in Table H–1.<br />

If a Fieldata image is read, it is translated to ASCII/ISO before being returned to the<br />

caller. See 17.3 for details on allowed input character set types.<br />

19–6 7833 1733–004


19.1.2. PLUS ATREAD Procedures Buffers and Tables<br />

SAR$ ATREAD<br />

All buffers and tables must be provided by the calling program. The type definitions for<br />

the buffers and tables, and definitions for the default buffer and table lengths, are<br />

contained in the element SAR$DEFN in the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or<br />

SYS$*RLIB$. They may be obtained with the COPY statement. The buffers and tables<br />

for the ATREAD function are similar to the buffers and tables for the READ and WRITE<br />

functions. See 17.1.2 and 18.1.2 for details on the buffers and tables.<br />

The default buffer and table lengths are listed in Table 19–1.<br />

Table 19–1. SAR$: PLUS ATREAD Buffer and Table<br />

Length Defaults<br />

Identifier Value<br />

SAR_IO_BUFFER_WORD_LENGTH 448<br />

SAR_IMAGE_BUFFER_WORD_LENGTH 63<br />

SAR_TEXT_BUFFER_BYTE_LENGTH 132<br />

SAR_ATTRIBUTE_TABLE_WORD_LENGTH 40<br />

SAR_SELECT_LIST_BYTE_LENGTH 4<br />

The buffer and table type definitions are listed in Table 19–2.<br />

Table 19–2. SAR$: PLUS ATREAD Buffer and Table<br />

Type Definitions<br />

Identifier Type<br />

SAR_IO_BUFFER 448 words logical locatable<br />

SAR_IMAGE_BUFFER 63 words logical locatable<br />

SAR_TEXT_BUFFER 132 ASCII characters locatable<br />

SAR_ATTRIBUTE_TABLE 40 words logical locatable<br />

SAR_SELECT_LIST 4 bytes logical locatable<br />

The element SAR$DEFN also contains other definitions necessary to SAR$.<br />

7833 1733–004 19–7


SAR$ ATREAD<br />

19.1.3. ATREAD Procedures Called from PLUS<br />

The procedures for the ATREAD function are<br />

• SAR_INITIALIZE_ATREAD<br />

• SAR_ATREAD<br />

• SAR_RESTORE_ATREAD<br />

The procedure declarations for SAR_INITIALIZE_ATREAD, SAR_ATREAD, and<br />

SAR_RESTORE_ATREAD are contained in the element SAR$ATR$DG in the <strong>SYSLIB</strong> file<br />

SYS$LIB$*<strong>SYSLIB</strong>. This element may be obtained with the COPY statement.<br />

SAR$ATR$DG contains all three procedure declarations. All of the ATREAD procedure<br />

modules are compiled with the G option using the IBJ$ calling sequence.<br />

19.1.3.1. SAR_INITIALIZE_ATREAD Procedure Call<br />

The ATREAD packet data structure must be initialized before calling SAR_ATREAD. The<br />

SAR_INITIALIZE_ATREAD procedure performs the ATREAD packet initialization.<br />

Initial Conditions<br />

The calling program sets the following parameters in the ATREAD packet to appropriate<br />

values before calling SAR_INITIALIZE_ATREAD:<br />

• Required parameters (described in 19.1.1.1)<br />

PACKET_VERSION<br />

IMAGE_BUFFER_ADDRESS<br />

IMAGE_BUFFER_WORD_LENGTH<br />

• Optional parameters (described in 19.1.1.2)<br />

INPUT_SELECT_LIST_ADDRESS<br />

NPUT_SELECT_LIST_BYTE_LENGTH<br />

NPUT_REQUEST_TYPE<br />

PRINT_CONTROL_WIDTH<br />

Note: The caller should zero-fill the ATREAD packet before placing any parameters in<br />

the packet.<br />

Calling Format<br />

PROCEDURE SAR_INITIALIZE_ATREAD<br />

(ATREAD_PACKET_ADDRESS: WORD MACHINE POINTER)<br />

IMPORTED ('SAR$INATR$PG');<br />

Returns<br />

SAR_INITIALIZE_ATREAD returns the initialization status in the packet in CALL_STATUS.<br />

If the status is S'Normal', the initialization of the ATREAD packet is successful.<br />

Otherwise an error has occurred and CALL_STATUS contains the status code.<br />

See 19.1.4 for the ATREAD function status code lists.<br />

19–8 7833 1733–004


19.1.3.2. SAR_ATREAD Procedure Call<br />

SAR$ ATREAD<br />

The SAR_ATREAD procedure constructs an image from the output text and output<br />

attributes, writes the image to the current output stream, reads an image from the<br />

current input stream, and returns the character text and attributes of the image to the<br />

calling program.<br />

Initial Conditions<br />

The calling program sets the following parameters in the packet to appropriate values<br />

before calling SAR_ATREAD:<br />

• Required parameters (described in 19.1.1.1)<br />

OUTPUT_TEXT_BUFFER_ADDRESS<br />

OUTPUT_TEXT_BUFFER_BYTE_LENGTH<br />

OUTPUT_ATTRIBUTE_TABLE_ADDRESS<br />

OUTPUT_ATTRIBUTE_TABLE_WORD_LENGTH<br />

INPUT_TEXT_BUFFER_ADDRESS<br />

INPUT_TEXT_BUFFER_BYTE_LENGTH<br />

INPUT_ATTRIBUTE_TABLE_ADDRESS<br />

INPUT_ATTRIBUTE_TABLE_WORD_LENGTH<br />

• Optional parameters (described in 19.1.1.2)<br />

OUTPUT_CHARACTER_TYPE<br />

OUTPUT_IMAGE_LINE_SPACING<br />

Calling Format<br />

PROCEDURE SAR_ATREAD<br />

(ATREAD_PACKET_ADDRESS: WORD MACHINE POINTER)<br />

IMPORTED (‘SAR$ATR$PG’);<br />

Returns<br />

SAR_ATREAD returns the calling status in the ATREAD packet field CALL_STATUS.<br />

If the status is S'Normal', then the call was successful. Following is the information<br />

returned by SAR$ to the caller:<br />

• Character text<br />

The address of the character text and the length in 9-bit bytes (characters) are<br />

returned in the fields INPUT_TEXT_BUFFER_ADDRESS and<br />

BYTE_LENGTH_OF_INPUT_TEXT, respectively.<br />

• Character type<br />

The character set type of the image read is returned in the field<br />

INPUT_CHARACTER_TYPE. The octal code of the character set type is returned in<br />

the field INPUT_CHARACTER_CODE.<br />

7833 1733–004 19–9


SAR$ ATREAD<br />

• Attributes<br />

The address of the attribute table and the number of entries are returned in the<br />

fields INPUT_ATTRIBUTE_TABLE_ADDRESS and NUMBER_OF_INPUT<br />

ATTRIBUTES, respectively.<br />

SAR_ATREAD does not space-fill the input text buffer if the input character text length is<br />

less than the length of the input text buffer. If the input character text length is greater<br />

than the length of the input text buffer, then SAR_ATREAD truncates the character text<br />

and returns an error status to the calling program.<br />

If an end-of-file condition is encountered by SAR_ATREAD, the CALL_STATUS field of<br />

the ATREAD packet is set to status S'End_of_file'.<br />

If the status returned from SAR_ATREAD is not S'Normal' or S'End_of_file', then an<br />

error has occurred and CALL_STATUS contains the status code. See 19.1.4 for a list of<br />

ATREAD function status codes.<br />

Note: SAR$ may expand the line width if necessary. The line width may be reset to<br />

the print device default by calling the SAR_RESTORE_ATREAD procedure. The<br />

expansion of the line width is to allow for the additional bytes required in the ASCII/ISO<br />

with embedded shift-coded KANJI and ACD character types, and for transmitting large<br />

data records, such as a full screen of characters.<br />

19–10 7833 1733–004


19.1.4. SAR_RESTORE_ATREAD Procedure Call<br />

SAR$ ATREAD<br />

The SAR_RESTORE_ATREAD procedure restores the caller's environment, if it was<br />

changed by SAR_ATREAD. Specifically, if SAR_ATREAD changed the print line width,<br />

SAR_RESTORE_ATREAD will reset the print line width to the device default.<br />

There are no required packet parameters for the SAR_RESTORE_ATREAD call.<br />

However, SAR_RESTORE_ATREAD expects that a prior call to the<br />

SAR_INITIALIZE_ATREAD routine was made.<br />

Calling Format<br />

PROCEDURE SAR_RESTORE_ATREAD<br />

(ATREAD_PACKET_ADDRESS: WORD MACHINE POINTER)<br />

IMPORTED (‘SAR$RSATR$PG’);<br />

Returns<br />

SAR_RESTORE_ATREAD returns the calling status in the ATREAD packet field,<br />

CALL_STATUS. If the status is S'Normal', then the call was successful.<br />

If the status returned from SAR_RESTORE_ATREAD is not S'Normal', then an error has<br />

occurred, and CALL_STATUS contains the status code. See 19.1.5 for a list of ATREAD<br />

function status codes.<br />

19.1.5. Status Lists for PLUS ATREAD Procedures<br />

The ATREAD procedure call status codes listed in Table 19–3 may be returned to the<br />

calling program in the CALL_STATUS field of the ATREAD packet. These CALL_STATUS<br />

codes are for SAR_ATREAD_PACKET_CURRENT_VERSION = 1 and above. A list of all<br />

call status codes is available as ATREAD_CALL_STATUS_LIST, an 18-bit status data<br />

entity defined in the element SAR$ATRPKTD.<br />

Table 19–3. SAR$: ATREAD Procedure CALL_STATUS Codes<br />

Octal Code Status<br />

0 Normal return from the ATREAD procedure.<br />

01 End-of-file condition reached by SAR_ATREAD.<br />

02 An I/O error has occurred in an ATREAD procedure. See the<br />

IO_STATUS_CODE field for the status code.<br />

03 An outdated ATREAD packet version is being used.<br />

04 An invalid ATREAD packet version is being used.<br />

05 The ATREAD packet is not initialized; a call to SAR_INITIALIZE_ATREAD<br />

must be made before calling SAR_ATREAD.<br />

06 The value for IMAGE_BUFFER_ADDRESS is NULL; an address must be<br />

given for the input image buffer.<br />

7833 1733–004 19–11


SAR$ ATREAD<br />

Table 19–3. SAR$: ATREAD Procedure CALL_STATUS Codes<br />

Octal Code Status<br />

07 The IMAGE_BUFFER_WORD_LENGTH is zero; a length must be given for<br />

the input image buffer.<br />

010 The value for OUTPUT_TEXT_BUFFER_ADDRESS is NULL; an address must<br />

be given for the output text buffer.<br />

011 The OUTPUT_TEXT_BUFFER_BYTE_LENGTH is zero; a length must be given<br />

for the output text buffer.<br />

012 The value for INPUT_TEXT_BUFFER_ADDRESS is NULL; an address must be<br />

given for the input text buffer.<br />

013 The INPUT_TEXT_BUFFER_BYTE_LENGTH is zero; a length must be given<br />

for the input text buffer.<br />

014 An invalid value is specified for the INPUT_REQUEST_TYPE field.<br />

015 An illegal character set type is specified for the<br />

OUTPUT_CHARACTER_TYPE.<br />

016 The character set type of the input image is invalid.<br />

017 The input or output image is too long to fit in the image buffer. The image<br />

buffer word length necessary to hold the entire image is returned in the field<br />

RECOMMENDED_BUFFER_LENGTH.<br />

020 The character text is too long to fit in the input text buffer and has been<br />

truncated. The text buffer byte length necessary to hold the character text is<br />

returned in the field RECOMMENDED_BUFFER_LENGTH.<br />

021 The number of attributes is too large to fit in the input attribute table. The<br />

attribute table word length necessary to hold all the attributes is returned in<br />

the field RECOMMENDED_BUFFER_LENGTH.<br />

022 An incorrect internal format to ACD translation routine version is being used.<br />

023 An incorrect ACD to internal format translation routine version is being used.<br />

024 The output attribute table contains an index that is either zero, not in<br />

sequential order, or greater than the output text length.<br />

025 The output attribute table contains an invalid attribute type or an invalid value<br />

for an attribute type.<br />

026 The image read contains incorrectly formatted ACD or incorrectly formatted<br />

embedded shift-coded kanji.<br />

027 A partial image was read by SYMB$.<br />

0100 An unrecognized error has occurred in an ACD subroutine. The ACD error<br />

code is returned in the SUB_STATUS field.<br />

0101 An unrecognized error has occurred in executing ER SYMB$. The SYMB$<br />

error code is returned in the SUB_STATUS field.<br />

0102 An incorrect ER SYMB$ packet version is being used. The correct SYMB$<br />

packet version is returned in the SUB_STATUS field.<br />

A CALL_STATUS code of 0100 or greater is a SAR$ internal error.<br />

19–12 7833 1733–004


SAR$ ATREAD<br />

The ATREAD procedure I/O status codes listed in Table 19–4 may be returned to the<br />

caller in the IO_STATUS field of the ATREAD packet.<br />

Table 19–4. SAR$: ATREAD Procedure IO_STATUS Status List<br />

Octal Code Status<br />

0 Normal I/O status.<br />

01 to 040 See Table C–2, I/O Status Codes, Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong><br />

for an explanation of the I/O status codes.<br />

19.2. ATREAD Function/MASM Interface<br />

The SAR$ ATREAD function writes a symbolic image to the current output stream and<br />

reads a symbolic image from the current input stream.<br />

The SAR$ ATREAD procedures can be called directly from MASM. The SAR$ data<br />

structure definitions and procedure calls are defined by MASM procedures (PROCs).<br />

The element SAR$PROCS contains these PROCs.<br />

19.2.1. ATREAD Packet and Data Area Description<br />

The SAR$ READ function requires an ATREAD packet and data area for the INITIALIZE-<br />

ATREAD and ATREAD calls.<br />

The S$ARATRDEF PROC generates the EQUFs defining the ATREAD packet fields. The<br />

word length of the MASM ATREAD packet and data area is at label SA$PKTWLEN<br />

defined by the S$ARATRDEF PROC (the current length is 61 words).<br />

19.2.1.1. Required Information for ATREAD Procedures<br />

The calling program must set the following fields of the ATREAD packet to appropriate<br />

values:<br />

SA$PKTVER<br />

The ATREAD packet data structure version. The current version is equal to the label<br />

SA$CURVER defined by the S$ARATRDEF PROC.<br />

SA$IMGBUF<br />

The address of the image buffer which ATREAD uses to construct images to be<br />

written out and to read input images into.<br />

SA$IMGBUFL<br />

The length in words of the image buffer.<br />

7833 1733–004 19–13


SAR$ ATREAD<br />

SA$OTEXTB<br />

The address of the output text buffer, into which the caller places the character text<br />

to be written out.<br />

SA$OTEXTBL<br />

The length in 9-bit bytes of the character text in the text buffer.<br />

SA$OATTRT<br />

The address of the output attribute table into which the caller places the attributes<br />

describing the character text to be written out. This field is undefined if the output<br />

attribute table word length is zero.<br />

SA$OATTRTL<br />

The number of valid entries in the attribute table. (Each entry is one word.) A value<br />

of zero indicates there is no output attribute table.<br />

SA$ITEXTB<br />

The address of the input text buffer into which ATREAD places the character text of<br />

the image read.<br />

SA$ITEXTBL<br />

The length in 9-bit bytes of the input text buffer.<br />

SA$IATTRT<br />

The address of the input attribute table into which ATREAD places the attributes<br />

describing the character text of the image read. This field is undefined if the input<br />

attribute table word length is zero.<br />

SA$IATTRTL<br />

The length in words of the input attribute table. A length of zero indicates that there<br />

is no input attribute table.<br />

19.2.1.2. Optional Information for ATREAD Procedures<br />

The calling program may optionally set the following fields of the ATREAD packet.<br />

The default values are obtained by zero-filling the ATREAD packet before placing any<br />

information in the packet.<br />

19–14 7833 1733–004


SA$OCHART<br />

The character set type of the image to be output by ATREAD:<br />

SAR$ ATREAD<br />

0 ASCII/ISO 9-bit characters (default), including all ASCII-like types in Table H–1.<br />

1 Attributed character data (ACD).<br />

Other character set types may not be written out by ATREAD. See 18.3 for details<br />

on the allowed output character set types.<br />

SA$LINESPA<br />

The number of lines to space before writing out the image (default is 1).<br />

SA$ISLIST<br />

The address of the input select list that specifies which attributes of the input image<br />

to return to the caller. This field is undefined if the input select list byte length is<br />

zero.<br />

SA$ISLISTL<br />

The length in 9-bit bytes of the input select list. A length of zero indicates that there<br />

is no input select list (default).<br />

SA$REQTYPE<br />

The requested type of input:<br />

0<br />

1<br />

SA$PCW<br />

Do not search for embedded shift-coded kanji in ASCII/ISO (default)<br />

Search for any embedded shift-coded kanji in ASCII/ISO input, and convert it into<br />

internal format (text part and attributes part).<br />

The number of words to set the print line width to. This value may be determined<br />

by dividing the desired number of columns by the constant SA$PCW$CHARS. This<br />

value must be set prior to calling S$ARINITATR. If this field is not set, the print line<br />

width will not be changed by S$ARINITATR (it may still be changed by<br />

S$ARATREAD if an image is encountered which is greater than the current print line<br />

width). Following the call to S$ARINITATR, this field is used to keep track of the<br />

current print line width; therefore, the caller should not modify this field following the<br />

S$ARINITATR call.<br />

7833 1733–004 19–15


SAR$ ATREAD<br />

19.2.1.3. Information Returned by ATREAD Procedures<br />

The following fields of the ATREAD packet contain values returned by the SAR$<br />

ATREAD procedures to the calling program:<br />

SA$STATUS<br />

The ATREAD function status word; it contains the call status in H2, the substatus in<br />

S1, and the I/O status in S3.<br />

SA$CALLST<br />

The status code of the INITIALIZE-ATREAD or ATREAD procedure call. See Table<br />

19–6 for an explanation of the octal status codes.<br />

SA$SUBSTAT<br />

This field contains additional information for particular call status codes.<br />

SA$IOSTAT<br />

The status of any I/O operations performed by the ATREAD procedures. See Table<br />

19–7 for the octal status codes.<br />

SA$SYMBST<br />

The status word returned from an ER SYMB$ request. See the SYMB$ section,<br />

Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further details on the SYMB$ status<br />

word.<br />

SA$RECBUFL<br />

The recommended buffer or table length when an invalid length is specified or when<br />

an overflow occurs.<br />

SA$OIMGLEN<br />

The length in bytes of the image written out by ATREAD.<br />

SA$TEXTLEN<br />

The length in 9-bit bytes of the character text returned in the text buffer.<br />

SA$NUMATTR<br />

The number of attributes returned in the attribute table.<br />

19–16 7833 1733–004


SA$ICHART<br />

The character set type of the image read:<br />

01 ASCII/ISO 9-bit characters<br />

077 Attributed character data (ACD)<br />

A value of any ASCII-like character set type defined in Table H–1.<br />

SAR$ ATREAD<br />

If a Fieldata image is read, it is translated to ASCII/ISO before it is returned to the<br />

caller. See 17.3 for details on allowed input character set types.<br />

19.2.1.4. ATREAD Packet Definition PROC (S$ARATRDEF)<br />

The S$ARATRDEF PROC generates the EQUFs to define the ATREAD packet. The<br />

calling program may optionally attach an X-register and a B-register to these EQUFs.<br />

This allows the calling program to allocate storage space for the ATREAD packet either<br />

statically at assembly time or dynamically at execution time. The calling program may<br />

display the EQUF labels by setting the display-flag parameter on the PROC call.<br />

This PROC also generates EQUs defining the ATREAD packet current version and word<br />

length at labels SA$CURVER and SA$PKTWLEN, respectively.<br />

Calling Format<br />

S$ARATRDEF x-reg,b-reg,dispflg<br />

Parameters<br />

x-reg<br />

b-reg<br />

dispflg<br />

The X-register to be attached to the ATREAD packet EQUFs. If it is omitted, no<br />

X-register is attached to the EQUFs.<br />

The B-register to be attached to the ATREAD packet EQUFs. If it is omitted, no<br />

B-register is attached to the EQUFs.<br />

A flag to display a table of the ATREAD packet EQUFs. If it is set to 'D', the field<br />

names are displayed; otherwise the field names are not displayed.<br />

Example<br />

$ASCII<br />

$INCLUDE ‘MAXR$’<br />

S$ARATRDEF X6,B3,‘D’<br />

The PROC call S$ARATRDEF generates EQUFs using registers X6 and B3 and displays a<br />

description of each packet field.<br />

7833 1733–004 19–17


SAR$ ATREAD<br />

19.2.1.5. ATREAD Packet Generation PROC (S$ARATRPKT)<br />

The S$ARATRPKT PROC generates an ATREAD packet, and reserves space for an image<br />

buffer, output text buffer, output attribute table, input text buffer, and input attribute<br />

table. S$ARATRPKT also calls the S$ARATRDEF PROC, which defines the ATREAD<br />

packet fields.<br />

Calling Format<br />

S$ARATRPKT x-reg,b-reg,dispflg<br />

The parameters for S$ARATRPKT are the same as for the S$ARATRDEF PROC (see<br />

19.2.1.4).<br />

Returns<br />

The S$ARATRPKT PROC places values in the following fields of the ATREAD packet:<br />

SA$PKTVER SA$IMGBUF SA$IMGBUFL<br />

SA$OTEXTB SA$OATTRT SA$ITEXTB<br />

SA$ITEXTBL SA$ATTRT SA$IATTRTL<br />

All other packet fields are set to default values. However, the calling program must still<br />

place values in the SA$OTEXTBL and SA$OATTRTL fields before calling S$ARATREAD.<br />

The generated buffers and tables use the default lengths (see Table 19–5). The<br />

following externalized labels are used to reference the buffers and tables:<br />

SAIMGBUF Image buffer<br />

SAOTEXTB Output text buffer<br />

SAOATTRT Output attribute table<br />

SAITEXTB Input text buffer<br />

SAIATTRT Input attribute table<br />

19–18 7833 1733–004


19.2.2. MASM ATREAD Procedures Buffers and Tables<br />

SAR$ ATREAD<br />

All buffers and tables must be provided by the calling program. The recommended<br />

lengths for the buffers and tables are equated to labels in the S$ARATRDEF PROC.<br />

These lengths and labels are listed in Table 19–5. The buffers and tables for the<br />

ATREAD function are similar to the buffers and tables for the READ and WRITE<br />

functions. See 17.1.2 and 18.1.2 for details on the buffers and tables.<br />

Table 19–5. SAR$: MASM ATREAD Buffer and<br />

Table Lengths<br />

Label Value<br />

SA$IMGBUFDL (Image buffer word length) 63<br />

SA$TEXBUFDL (Text buffer byte length) 132<br />

SA$ATTRIBDL (Attribute table word length) 40<br />

SA$SELLSTDL (Select list byte length) 4<br />

19.2.3. ATREAD Procedures Called from MASM<br />

The MASM procedures for the ATREAD function are<br />

• S$ARINITATR (initialize ATREAD)<br />

• S$ARATREAD (call ATREAD)<br />

• S$ARRSATR (reset ATREAD)<br />

19.2.3.1. Initialize ATREAD Procedure Call (S$ARINITATR)<br />

The ATREAD packet and data area must be initialized before any calls are made to<br />

ATREAD. The S$ARINITATR PROC performs the ATREAD packet initialization.<br />

Initial Conditions<br />

The calling program sets the following parameters in the ATREAD packet to appropriate<br />

values before calling S$ARINITATR:<br />

• Required parameters (described in 19.2.1.1)<br />

SA$PKTVER<br />

SA$IMGBUF<br />

SA$IMGBUFL<br />

7833 1733–004 19–19


SAR$ ATREAD<br />

• Optional parameters (described in 19.2.1.2)<br />

SA$ISLIST<br />

SA$ISLISTL<br />

SA$REQTYPE<br />

SA$PCW<br />

Note: It is recommended that the calling program zero-fill the ATREAD packet before<br />

placing any parameters in the packet.<br />

Calling Format<br />

S$ARINITATR atrpkt<br />

error return<br />

normal return<br />

where atrpkt is a label identifying the starting address of the ATREAD packet and data<br />

area.<br />

Returns<br />

If S$ARINITATR takes the error return, A1 contains the call status code, A2 contains the<br />

I/O status code, and A3 contains the substatus code. These status codes are also<br />

returned in the packet fields SA$CALLST, SA$IOSTAT, and SA$SUBSTAT, respectively.<br />

See 19.2.4 for an explanation of the status codes.<br />

If S$ARINITATR takes the normal return, the initialization of the ATREAD packet is<br />

successful.<br />

19.2.3.2. ATREAD Procedure Call (S$ARATREAD)<br />

The S$ARATREAD PROC constructs an image from the output text and output<br />

attributes, writes the image to the current output stream, reads an image from the<br />

current input stream, and returns the character text and attributes of the image to the<br />

calling program.<br />

Initial Conditions<br />

The calling program sets the following parameters in the ATREAD packet to appropriate<br />

values before calling S$ARATREAD:<br />

• Required parameters (described in 19.2.1.1)<br />

SA$OTEXTB<br />

SA$OATTRTL<br />

SA$IATTRT<br />

SA$OTEXTBL<br />

SA$ITEXTB<br />

SA$IATTRTL<br />

SA$OATTRT<br />

SA$ITEXTBL<br />

19–20 7833 1733–004


• Optional parameters (described in 19.2.1.2)<br />

SA$OCHART<br />

SA$LINESPA<br />

Calling Format<br />

S$ARATREAD atrpkt<br />

error return<br />

end-of-file return<br />

normal return<br />

SAR$ ATREAD<br />

where atrpkt is a label identifying the starting address of the ATREAD packet and data<br />

area.<br />

Returns<br />

error<br />

If S$ARATREAD takes the error return, A1 contains the call status code, A2 contains<br />

the I/O status code, and A3 contains the substatus code. These status codes are<br />

also returned in the packet fields SA$CALLST, SA$IOSTAT, and SA$SUBSTAT,<br />

respectively. See 19.2.4 for an explanation of the status codes.<br />

end-of-file<br />

normal<br />

If S$ARATREAD takes the end-of-file return, the ATREAD request encountered an<br />

end-of-file condition. A1 contains the call status code, A2 contains the I/O status<br />

code, and A3 contains the substatus code. These status codes are also returned in<br />

the packet fields SA$CALLST, SA$IOSTAT, and SS$SUBSTAT, respectively.<br />

If S$ARATREAD takes the normal return, the ATREAD call was successful. The<br />

following information is returned by ATREAD to the caller:<br />

• Character text<br />

The address of the character text and the length in 9-bit bytes (characters) are<br />

returned in the fields SA$ITEXTB and SA$TEXTLEN, respectively.<br />

• Character type<br />

The character set type of the image read is returned in the field SA$ICHART.<br />

• Attributes<br />

The address of the attribute table and the number of entries are returned in the<br />

fields SA$IATTRT and SA$NUMATTR, respectively.<br />

7833 1733–004 19–21


SAR$ ATREAD<br />

S$ARATREAD does not space-fill the input text buffer when the input character text<br />

length is less than the length of the input text buffer. If the input character text length is<br />

greater than the length of the input text buffer, S$ARATREAD truncates the character<br />

text and returns an error status to the calling program.<br />

Note: SAR$ may expand the line width, if necessary. The line width may be reset to<br />

the print device default by calling the S$ARRSATR (restore ATREAD) procedure. The<br />

expansion of the line width is to allow for the additional bytes required in the ASCII/ISO<br />

with embedded shift-coded KANJI and ACD character types, and for transmitting large<br />

data records, such as a full screen of characters<br />

19.2.3.3. Reset ATREAD Procedure Call (S$ARRSATR)<br />

The S$ARRSATR PROC restores the caller's environment, if it was changed by<br />

S$ARATREAD. Specifically, if S$ARATREAD changed the print line width, S$ARRSATR<br />

will reset the print line width to the device default.<br />

There are no required packet parameters for the S$ARRSATR PROC call. However,<br />

S$ARRSATR expects that a prior call to the S$ARINITATR PROC was made.<br />

Calling format<br />

S$ARRSATR atrpkt<br />

error return<br />

normal return<br />

where atrpkt is a label identifying the start address of the ATREAD packet and data area.<br />

Returns<br />

If S$ARRSATR takes the normal return, the call was successful.<br />

If S$ARRSATR takes the error return, A1 contains the call status code. This status code<br />

is also returned in the packet field SA$CALLST. See 19.2.4 for an explanation of the<br />

status codes.<br />

19–22 7833 1733–004


19.2.4. Status Lists for MASM ATREAD Procedures<br />

SAR$ ATREAD<br />

The ATREAD procedure call status codes listed in Table 19–6 may be returned to the<br />

calling program in the SA$CALLST field of the ATREAD packet. These call status codes<br />

are for SA$CURVER = 1 and above.<br />

Table 19–6. SAR$: ATREAD Procedure SA$CALLST Status Codes<br />

Octal Code Status<br />

0 Normal return from the ATREAD procedure.<br />

01 End-of-file condition reached by S$ARATREAD.<br />

02 An I/O error has occurred in an ATREAD procedure. See the SA$IOSTAT<br />

field and Table 19–7 for the status code.<br />

03 An outdated ATREAD packet version is being used.<br />

04 An invalid ATREAD packet version is being used.<br />

05 The ATREAD packet is not initialized; a call to S$ARINITATR must be made<br />

before calling S$ARATREAD.<br />

06 The value for SA$IMGBUF is zero; an address must be given for the image<br />

buffer.<br />

07 The value for SA$IMGBUFL is zero; a length must be given for the image<br />

buffer.<br />

010 The value for SA$OTEXTB is zero; an address must be given for the output<br />

text buffer.<br />

011 The value for SA$OTEXTBL is zero; a length must be given for the output<br />

text buffer.<br />

012 The value for SA$ITEXTB is zero; an address must be given for the input text<br />

buffer.<br />

013 The value for SA$ITEXTBL is zero; a length must be given for the input text<br />

buffer.<br />

014 An invalid value is specified for SA$REQTYPE.<br />

015 An illegal character set type is specified for SA$OCHART.<br />

016 The character set type of the input image is invalid.<br />

017 The input or output image is too long to fit in the image buffer. The image<br />

buffer word length necessary to hold the entire image is returned in the field<br />

SA$RECBUFL.<br />

020 The character text is too long to fit in the input text buffer and has been<br />

truncated. The text buffer byte length necessary to hold the character text is<br />

returned in the field SA$RECBUFL.<br />

021 The number of attributes is too large to fit in the input attribute table. The<br />

attribute table word length necessary to hold all the attributes is returned in<br />

the field SA$RECBUFL.<br />

022 An incorrect internal format to ACD translation routine version is being used.<br />

023 An incorrect ACD to internal format translation routine version is being used.<br />

7833 1733–004 19–23


SAR$ ATREAD<br />

Table 19–6. SAR$: ATREAD Procedure SA$CALLST Status Codes<br />

Octal Code Status<br />

024 The output attribute table contains an index that is either zero, not in<br />

sequential order, or greater than the output text length.<br />

025 The output attribute table contains an invalid attribute type or an invalid value<br />

for an attribute type.<br />

026 The image read contains incorrectly formatted ACD or incorrectly formatted<br />

embedded shift-coded kanji.<br />

027 A partial image was read by SYMB$.<br />

0100 An unrecognized error has occurred in an ACD subroutine. The ACD error<br />

code is returned in the SA$SUBSTAT field.<br />

0101 An unrecognized error has occurred in executing ER SYMB$. The SYMB$<br />

error code is returned in the SA$SUBSTAT field.<br />

0102 An incorrect ER SYMB$ packet version is being used. The correct SYMB$<br />

packet version is returned in the SA$SUBSTAT field.<br />

A SA$CALLST status code of 0100 or greater is an SAR$ internal error.<br />

The ATREAD procedure I/O status codes listed in Table 19–7 may be returned to the<br />

caller in the SA$IOSTAT field of the ATREAD packet.<br />

Table 19–7. SAR$: ATREAD Procedure SA$IOSTAT Status Codes<br />

Status code Explanation<br />

0 Normal I/O status.<br />

01 to 040 See Table C–2, I/O Status Codes, Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

19–24 7833 1733–004


Section 20<br />

SAR$ COM<br />

20.1. SAR$ COM Function/PLUS Interface<br />

The SAR$ COM function writes a symbolic image to the operator's console, and<br />

optionally reads a symbolic image from the operator's console.<br />

The SAR$ COM procedure can be called directly from PLUS. All SAR$ data structure<br />

definitions and procedure calls are contained in definition elements and are obtained with<br />

the PLUS COPY statement.<br />

20.1.1. SAR$ COM Packet Data Structure Description<br />

The SAR$ COM function requires a COM packet data structure for the SAR_COM<br />

procedure call. The type definition for this data structure is contained in the element<br />

SAR$COMPKTD in the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>). This element may be obtained<br />

with the PLUS COPY statement. The identifier for the SAR$ COM packet data structure<br />

type is SAR_COM_PACKET.<br />

The calling program must provide storage space for the SAR$ COM packet data<br />

structure, plus any necessary buffers and tables, since SAR$ does not have any D-bank<br />

storage. The length of the SAR$ COM packet is equal to the constant<br />

SAR_COM_PACKET_WORD_LENGTH, defined in the element SAR$COMPKTD (current<br />

length is 25 words). The SAR_COM_PACKET data structure is defined as LOCATABLE.<br />

The calling program places information in the SAR$ COM packet data structure, and<br />

passes the address of the data structure to the SAR$ COM function through the<br />

procedure calls.<br />

20.1.1.1. Required Information for SAR$ COM Procedure<br />

The calling program must set the following fields of the SAR$ COM packet to<br />

appropriate values:<br />

PACKET_VERSION<br />

PLUS Attribute: 6-bit integer<br />

The SAR$ COM packet data structure version. The current version is equal to the<br />

constant SAR_COM_PACKET_CURRENT_VERSION defined in the element<br />

SAR$COMPKTD.<br />

7833 1733–004 20–1


SAR$ COM<br />

OUTPUT_TEXT_BUFFER_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the output text buffer, which contains the character text of the image<br />

that the SAR$ COM function writes out.<br />

OUTPUT_TEXT_BUFFER_BYTE_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in 9-bit bytes of the character text in the text buffer. This is the number<br />

of characters that the SAR$ COM function writes out.<br />

INPUT_TEXT_BUFFER_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the input text buffer, which contains the character text of the image<br />

that the SAR$ COM function reads in. This field is not necessary if<br />

INPUT_TEXT_BUFFER_BYTE_LENGTH is zero.<br />

INPUT_TEXT_BUFFER_BYTE_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in 9-bit bytes of the input text buffer; this is the maximum number of<br />

characters that the SAR$ COM function will read in. If this field is set to zero, no<br />

input is solicited from the operator's console.<br />

20.1.1.2. Optional Information for SAR$ COM Procedure<br />

The calling program may optionally set the following fields of the COM packet. The<br />

default values are obtained by zero-filling the COM packet before placing any information<br />

in the packet.<br />

OUTPUT_CHARACTER_TYPE<br />

PLUS Attribute: 6-bit status<br />

The character set type of the image written out by the SAR$ COM function.<br />

S'ASCII_ISO' ASCII/ISO 9-bit characters (default).<br />

S'ACD' Attributed character data (ACD)<br />

20–2 7833 1733–004


A value of any ASCII-like character set type in Table H–1.<br />

SAR$ COM<br />

Other character set types may not be written out by the SAR$ COM function. See<br />

18.3 for details on the allowed output character set types.<br />

IMAGE_BUFFER_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the image buffer; this buffer is necessary if either the output or input<br />

image character set types are ASCII/ISO with embedded shift-coded kanji or ACD.<br />

The default is no image buffer.<br />

IMAGE_BUFFER_WORD_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in words of the image buffer; a length must be specified if an address is<br />

given in IMAGE_BUFFER_ADDRESS. A length of zero indicates there is no image<br />

buffer (default).<br />

OUTPUT_ATTRIBUTE_TABLE_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the output attribute table which contains the attributes that describe<br />

the character text of the image that the SAR$ COM function writes out. If there are<br />

no attributes for the output image, this table is not necessary. The default is no<br />

output attribute table.<br />

OUTPUT_ATTRIBUTE_TABLE_WORD_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The number of valid entries in the attribute table. (Each entry is one word.) A value<br />

of zero indicates there is no output attribute table (default).<br />

INPUT_ATTRIBUTE_TABLE_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the input attribute table which contains the attributes that describe<br />

the character text of the image that the SAR$ COM function reads in. If the input<br />

image does not have any attributes, this table is not necessary. The default is no<br />

input attribute table.<br />

INPUT_ATTRIBUTE_TABLE_WORD_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in words of the input attribute table. A length of zero indicates there is<br />

no input attribute table (default).<br />

7833 1733–004 20–3


SAR$ COM<br />

INPUT_SELECT_LIST_ADDRESS<br />

PLUS Attribute: word pointer<br />

The address of the input select list that specifies which attributes of the input image<br />

to return to the caller. The default is no input select list.<br />

INPUT_SELECT_LIST_BYTE_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in 9-bit bytes of the input select list. A length of zero indicates there is no<br />

input select list (default).<br />

INPUT_REQUEST_TYPE<br />

PLUS Attribute: 6-bit status<br />

The request type for the input image.<br />

S'Pass_embedded_KANJI'<br />

Do not search for embedded shift-coded kanji in input images of character set<br />

type ASCII/ISO (default).<br />

S'Translate_embedded_KANJI'-<br />

Search ASCII/ISO input images for any embedded shift-coded kanji, and return<br />

the image in internal format (text part and attributes part). This request type<br />

requires an image buffer and an input attribute table.<br />

CONSOLE_CLASS<br />

PLUS Attribute: 6-bit status<br />

The console class that the ER COM$ request is directed to:<br />

S'System' System console (default).<br />

S'IO_activity' I/O activity console.<br />

S'Communications' Communications console.<br />

S'Hardware_confidence' Hardware confidence console.<br />

S'User_defined_4' Individual site-defined console for octal code 4.<br />

S'User_defined_5' Individual site-defined console for octal code 5.<br />

S'User_defined_6' Individual site-defined console for octal code 6.<br />

S'User_defined_7' Individual site-defined console for octal code 7.<br />

See the ER COM$ section, Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further<br />

details.<br />

20–4 7833 1733–004


CONTROL_BITS<br />

PLUS Attribute: 6-bit logical<br />

SAR$ COM<br />

The caller supplied control bits for the ER COM$ request (default is zero). See the<br />

ER COM$ section, Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further details.<br />

ADDITIONAL_CONTROL_BITS<br />

PLUS Attribute: 6-bit logical<br />

The caller supplied additional control bits for the ER COM$ request. SAR$ COM<br />

always sets bit 001 in addition to any caller supplied bits. See the ER COM$ section,<br />

Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further details.<br />

RUN_ID_FOR_LOGGING<br />

PLUS Attribute: 8 ASCII characters<br />

The run-id to use when logging the console message. See the ER COM$ section,<br />

Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further details.<br />

ROUTING_CONSOLE<br />

PLUS Attribute: 8 ASCII characters<br />

The console to which the message is sent. This definition is a legacy from Exec<br />

levels prior to 40R1 and is supplied for compatability only. All currently supported<br />

Exec levels use the ROUTING_INFORMATION definition, described below. See the<br />

Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further details.<br />

ROUTING_INFORMATION<br />

PLUS Attribute: 36-bit machine logical<br />

This caller supplied routing information overlays the first 4 characters of<br />

ROUTING_CONSOLE. This field should be used when the routing information to be<br />

supplied for the ER COM$ request is either a 6-Fieldata character-site id or binary<br />

information. See the ER COM$ section of the Exec ER <strong>Programming</strong> <strong>Reference</strong><br />

<strong>Manual</strong> for further details.<br />

7833 1733–004 20–5


SAR$ COM<br />

20.1.1.3. Information Returned by SAR$ COM Procedure<br />

The following fields of the SAR$ COM packet contain values returned by the SAR$ COM<br />

procedure to the calling program:<br />

CALL_STATUS<br />

PLUS Attribute: 18-bit status<br />

The status of the current call to the SAR_COM procedure. See Table 20–3 for an<br />

explanation of the SAR$ COM procedure call status codes. This field may also be<br />

referenced as an 18-bit logical field with label CALL_STATUS_CODE.<br />

SUB_STATUS_CODE<br />

PLUS Attribute: 6-bit logical<br />

This field contains additional information for particular CALL_STATUS codes.<br />

COM_STATUS_WORD<br />

PLUS Attribute: word logical<br />

A one-word combination of CALL_STATUS and SUB_STATUS contained in H2 and<br />

S1, respectively.<br />

RECOMMENDED_BUFFER_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The recommended buffer or table length returned by the SAR$ COM function when<br />

an invalid length is specified or when an overflow occurs.<br />

OUTPUT_IMAGE_BYTE_LENGTH<br />

PLUS Attribute: 18-bit integer<br />

The length in bytes of the image written out by the SAR_COM procedure.<br />

BYTE_LENGTH_OF_INPUT_TEXT<br />

PLUS Attribute: 18-bit integer<br />

The length in 9-bit bytes of the character text read from the operator's console and<br />

returned in the input text buffer.<br />

NUMBER_OF_INPUT_ATTRIBUTES<br />

PLUS Attribute: 18-bit integer<br />

The number of attributes returned in the input attribute table.<br />

20–6 7833 1733–004


20.1.2. SAR$ PLUS COM Procedure Buffers and Tables<br />

SAR$ COM<br />

All buffers and tables must be provided by the calling program. The type definitions for<br />

the buffers and tables and the definitions for the default buffer and table lengths are<br />

contained in the element SAR$DEFN in the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or<br />

SYS$*RLIB$. This element is obtained with the COPY statement. The buffers and<br />

tables for the COM function are similar to the buffers and tables for the READ and<br />

WRITE functions. See 17.1.2 and 18.1.2 for details on the buffers and tables. Note that<br />

for the COM function, the image buffer is not used if the input and output images do not<br />

have character attributes.<br />

The default buffer and table lengths are listed in Table 20–1.<br />

Table 20–1. SAR$: PLUS COM Buffer and Table Length<br />

Defaults<br />

Identifier Value<br />

SAR_IMAGE_BUFFER_WORD_LENGTH 63<br />

SAR_TEXT_BUFFER_BYTE_LENGTH 132<br />

SAR_ATTRIBUTE_TABLE_WORD_LENGTH 40<br />

SAR_SELECT_LIST_BYTE_LENGTH 4<br />

The buffer and table type definitions are listed in Table 20–2.<br />

Table 20–2. SAR$: PLUS COM Buffer and Table Type Definitions<br />

Identifier Type<br />

SAR_IMAGE_BUFFER 63 words logical locatable<br />

SAR_TEXT_BUFFER 132 ASCII characters locatable<br />

SAR_ATTRIBUTE_TABLE 40 words logical locatable<br />

SAR_SELECT_LIST 4 bytes logical locatable<br />

The element SAR$DEFN also contains other definitions necessary to SAR$.<br />

7833 1733–004 20–7


SAR$ COM<br />

20.1.3. SAR$ COM Procedure Called from PLUS<br />

The SAR$ COM function writes a symbolic image to the operator's console and<br />

optionally reads a symbolic image from the operator's console.<br />

The calling procedure for the COM function is SAR_COM.<br />

The procedure declaration for SAR_COM is contained in the element SAR$COM$DG, in<br />

the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or SYS$*RLIB$. This element is obtained with the<br />

COPY statement. The module containing the SAR_COM procedure uses the PLSSTACK<br />

and is compiled with the G option using the IBJ$ calling sequence.<br />

SAR_COM Procedure Call<br />

The SAR_COM procedure constructs an image from the output text and output<br />

attributes, writes the image to the operator's console, reads an image from the<br />

operator's console, and returns the character text and attributes of the image to the<br />

caller.<br />

Initial Conditions<br />

The calling program sets the following parameters in the packet to appropriate values<br />

before calling SAR_COM:<br />

• Required parameters (described in 20.1.1.1)<br />

PACKET_VERSION<br />

OUTPUT_TEXT_BUFFER_ADDRESS<br />

OUTPUT_TEXT_BUFFER_BYTE_LENGTH<br />

INPUT_TEXT_BUFFER_ADDRESS<br />

INPUT_TEXT_BUFFER_BYTE_LENGTH<br />

• Optional parameters (described in 20.1.1.2)<br />

OUTPUT_CHARACTER_TYPE<br />

INPUT_REQUEST_TYPE<br />

IMAGE_BUFFER_ADDRESS<br />

IMAGE_BUFFER_WORD_LENGTH<br />

OUTPUT_ATTRIBUTE_TABLE_ADDRESS<br />

OUTPUT_ATTRIBUTE_TABLE_WORD_LENGTH<br />

INPUT_ATTRIBUTE_TABLE_ADDRESS<br />

INPUT_ATTRIBUTE_TABLE_WORD_LENGTH<br />

INPUT_SELECT_LIST_ADDRESS<br />

INPUT_SELECT_LIST_BYTE_LENGTH<br />

CONSOLE_CLASS<br />

CONTROL_BITS<br />

ADDITIONAL_CONTROL_BITS<br />

RUN_ID_FOR_LOGGING<br />

ROUTING_CONSOLE<br />

ROUTING_INFORMATION<br />

20–8 7833 1733–004


Calling Format<br />

PROCEDURE SAR_COM(COM_PACKET_ADDRESS: WORD MACHINE POINTER)<br />

IMPORTED (‘SAR$COM$PG’);<br />

SAR$ COM<br />

Returns<br />

SAR_COM returns the calling status in the COM packet field CALL_STATUS. If the<br />

status is S'Normal', then the call was successful. The following information is returned<br />

by SAR$ to the calling program:<br />

• Character text<br />

If operator input was solicited, the address of the character text and the length in<br />

9-bit bytes (characters) are returned in the fields INPUT_TEXT_BUFFER_ADDRESS<br />

and BYTE_LENGTH_OF_INPUT_TEXT, respectively. The character set type of the<br />

image read is the same as the output image character set type.<br />

• Attributes<br />

If operator input was solicited, the address of the input attribute table and the<br />

number of entries are returned in the fields INPUT_ATTRIBUTE_TABLE_ADDRESS<br />

and NUMBER_OF_INPUT ATTRIBUTES, respectively.<br />

If the status returned from SAR_COM is not S'Normal' or S'End_of_file', then an error<br />

has occurred and CALL_STATUS contains the status code. See 20.1.4 for a list of COM<br />

function status codes.<br />

20.1.4. Status Lists for PLUS COM Procedure<br />

The COM procedure call status codes listed in Table 20–3 may be returned to the calling<br />

program in the CALL_STATUS field of the COM packet. These CALL_STATUS codes are<br />

for SAR_COM_PACKET_CURRENT_VERSION = 1 and above. A list of all call status<br />

codes is available as COM_CALL_STATUS_LIST, an 18-bit status data entity defined in<br />

the element SAR$COMPKTD.<br />

Table 20–3. SAR$: COM Procedure CALL_STATUS Codes<br />

Octal Code Status<br />

0 Normal return from the SAR$ COM procedure.<br />

01 An outdated SAR$ COM packet version is being used.<br />

02 An invalid SAR$ COM packet version is being used.<br />

03 The value for IMAGE_BUFFER_ADDRESS is NULL; an address must be<br />

given for the input image buffer.<br />

04 The IMAGE_BUFFER_WORD_LENGTH is zero; a length must be given for<br />

the input image buffer.<br />

05 An invalid value is specified for the INPUT_REQUEST_TYPE field.<br />

7833 1733–004 20–9


SAR$ COM<br />

Table 20–3. SAR$: COM Procedure CALL_STATUS Codes<br />

Octal Code Status<br />

06 An illegal character set type is specified for the<br />

OUTPUT_CHARACTER_TYPE.<br />

07 An illegal value is specified for the OUTPUT_TEXT_BUFFER_ADDRESS.<br />

010 The OUTPUT_TEXT_BUFFER_BYTE_LENGTH is zero; a length must be given<br />

for the output text buffer.<br />

011 An illegal value is specified for INPUT_TEXT_BUFFER_ADDRESS.<br />

012 There are no valid characters in the output image.<br />

013 The input or output image is too long to fit in the image buffer. The image<br />

buffer word length necessary to hold the entire image is returned in the field<br />

RECOMMENDED_BUFFER_LENGTH.<br />

014 The character text is too long to fit in the input text buffer and has been<br />

truncated. The text buffer byte length necessary to hold the character text is<br />

returned in the field RECOMMENDED_BUFFER_LENGTH.<br />

015 The number of attributes is too large to fit in the input attribute table. The<br />

attribute table word length necessary to hold all the attributes is returned in<br />

the field RECOMMENDED_BUFFER_LENGTH.<br />

016 An incorrect internal format to ACD translation routine version is being used.<br />

017 An incorrect ACD to internal format translation routine version is being used.<br />

020 The output attribute table contains an index that is either zero, not in<br />

sequential order, or greater than the output text length.<br />

021 The output attribute table contains an invalid attribute type or an invalid value<br />

for an attribute type.<br />

022 The image read contains incorrectly formatted ACD or incorrectly formatted<br />

embedded shift-coded kanji.<br />

023 The caller has illegally set a secured control bit in the CONTROL_BITS field.<br />

024 The current Exec level does not allow ACD to be output or input with ER<br />

COM$.<br />

0100 An unrecognized error has occurred in an ACD subroutine. The ACD error<br />

code is returned in the SUB_STATUS field.<br />

0101 An unrecognized error has occurred in executing ER COM$. The COM$<br />

error code is returned in the SUB_STATUS field.<br />

A CALL_STATUS code of 0100 or greater is a SAR$ internal error.<br />

20–10 7833 1733–004


20.2. SAR$ COM Function/MASM Interface<br />

The SAR$ COM function writes a symbolic image to the operator's console and<br />

optionally reads a symbolic image from the operator's console.<br />

SAR$ COM<br />

The SAR$ COM procedure is callable directly from MASM. The SAR$ data structure<br />

definitions and procedure calls are defined by MASM procedures (PROCs). The element<br />

SAR$PROCS contains these PROCs.<br />

20.2.1. SAR$ COM Packet and Data Area Description<br />

The SAR$ COM function requires a SAR$ COM packet and data area for the COM<br />

procedure call. The S$ARCOMDEF PROC generates the EQUFs defining the COM<br />

packet fields. The word length of the SAR$ MASM COM packet and data area is at label<br />

SC$PKTWLEN defined by the S$ARCOMDEF PROC (the current length is 57 words).<br />

20.2.1.1. Required Information for SAR$ COM Procedure<br />

The calling program must set the following fields of the COM packet to appropriate<br />

values:<br />

SC$PKTVER<br />

The SAR$ COM packet data structure version. The current version is equal to the<br />

label SC$CURVER defined by the S$ARCOMDEF PROC.<br />

SC$OTEXTB<br />

The address of the output text buffer which contains the character text of the image<br />

that the SAR$ COM function writes out.<br />

SC$OTEXTBL<br />

The length in 9-bit bytes of the character text in the text buffer. This is the number<br />

of characters that the SAR$ COM function writes out.<br />

SC$ITEXTB<br />

The address of the input text buffer which contains the character text of the image<br />

that the SAR$ COM function reads in. This field is not necessary if SC$ITEXTBL is<br />

set to zero.<br />

SC$ITEXTBL<br />

The length in 9-bit bytes of the input text buffer; this is the maximum number of<br />

characters that the SAR$ COM function will read in. If this field is set to zero, no<br />

input is solicited from the operator's console.<br />

7833 1733–004 20–11


SAR$ COM<br />

20.2.1.2. Optional Information for SAR$ COM Procedure<br />

The calling program may optionally set the following fields of the COM packet. The<br />

default values are obtained by zero-filling the SAR$ COM packet before placing any<br />

information in the packet.<br />

SC$OCHART<br />

The character set type of the image written out by the SAR$ COM function:<br />

0 ASCII/ISO 9-bit characters (default), including all ASCII-like types in Table H–1.<br />

1 Attributed character data (ACD).<br />

Other character set types may not be written out by the SAR$ COM. See 18.3 for<br />

details on the allowed output character set types.<br />

SC$IMGBUF<br />

The address of the image buffer; this buffer is necessary if either the output or input<br />

character set types are ASCII/ISO with embedded shift-coded kanji or ACD. The<br />

default is no image buffer.<br />

SC$IMGBUFL<br />

The length in words of the image buffer; a length must be specified if an address is<br />

given in SC$IMGBUF. A length of zero indicates there is no image buffer (default).<br />

SC$OATTRT<br />

The address of the output attribute table, which contains the attributes that describe<br />

the character text of the image that the SAR$ COM function writes out. If there are<br />

no attributes for the output image, this table is not necessary. The default is no<br />

output attribute table.<br />

SC$OATTRTL<br />

The number of valid entries in the attribute table. (Each entry is one word.) A value<br />

of zero indicates that there is no output attribute table (default).<br />

SC$IATTRT<br />

The address of the input attribute table, which contains the attributes that describe<br />

the character text of the image that the SAR$ COM function reads in. If the input<br />

image does not have any attributes, this table is not necessary. The default is no<br />

input attribute table.<br />

SC$IATTRTL<br />

The length in words of the input attribute table. A length of zero indicates that there<br />

is no input attribute table (default).<br />

20–12 7833 1733–004


SC$ISLIST<br />

SAR$ COM<br />

The address of the input select list that specifies which attributes of the input image<br />

to return to the caller. The default is no input select list.<br />

SC$ISLISTL<br />

The length in 9-bit bytes of the input select list. A length of zero indicates that there<br />

is no input select list (default).<br />

SC$REQTYPE<br />

The request type for the input image:<br />

0<br />

1<br />

SC$CONSCLA<br />

Do not search for embedded shift-coded kanji in input images of character set<br />

type ASCII/ISO (default).<br />

Search ASCII/ISO input images for any embedded shift-coded kanji, and return<br />

the image in internal format (text part and attributes part). This request type<br />

requires an image buffer and an input attribute table.<br />

The console class that the ER COM$ request is directed to:<br />

0 System console (default).<br />

1 I/O activity console.<br />

2 Communications console.<br />

3 Hardware confidence console.<br />

4, 5, 6, 7 Individual site-defined consoles for octal codes 4 to 7.<br />

See the ER COM$ section, Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further<br />

details.<br />

SC$CNTLB<br />

The caller-supplied control bits for the ER COM$ request (default is zero). See the<br />

ER COM$ section, Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further details.<br />

SC$ACNTLB<br />

The caller-supplied additional control bits for the ER COM$ request. SAR$ COM<br />

always sets bit 01 in addition to any caller supplied bits. See the ER COM$ section,<br />

Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for further details.<br />

7833 1733–004 20–13


SAR$ COM<br />

SC$RUNIDW1<br />

The first four ASCII characters of the run-id to use when logging the console<br />

message. See the ER COM$ section, Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for<br />

further details.<br />

SC$RUNIDW2<br />

The second four ASCII characters of the run-id.<br />

SC$ROUTW1<br />

Routing information on the console to which the message is to be sent. The word<br />

may be a 6-Fieldata character-site id or may be binary information returned by<br />

ER KEYIN$. See the ER COM$ section, Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong><br />

for further details.<br />

SC$ROUTW2<br />

A second word of routing information. This definition is a legacy from Exec levels<br />

prior to 40R1 and is supplied for compatibility only. All currently supported Exec<br />

levels use one word for routing information, the previously described SC$ROUTW1.<br />

20.2.1.3. Information Returned by COM Procedure<br />

The following fields of the SAR$ COM packet contain values returned by the SAR$ COM<br />

procedure to the calling program:<br />

SC$STATUS<br />

The COM function status word; it contains the call status in H2 and the substatus in<br />

S1.<br />

SC$CALLST<br />

The status code of the current COM procedure call. See Table 20–5 for an<br />

explanation of the octal status codes.<br />

SC$SUBSTAT<br />

This field contains additional information for particular call status codes.<br />

SC$RECBUFL<br />

The recommended buffer or table length returned by the SAR$ COM procedure<br />

when an invalid length is specified or when an overflow occurs.<br />

20–14 7833 1733–004


SC$OIMGLEN<br />

The length in bytes of the image written out by the SAR$ COM procedure.<br />

SC$TEXTLEN<br />

SAR$ COM<br />

The length in 9-bit bytes of the character text read from the operator's console and<br />

returned in the input text buffer.<br />

SC$NUMATTR<br />

The number of attributes returned in the input attribute table.<br />

20.2.1.4. COM Packet Definition PROC (S$ARCOMDEF)<br />

The MASM PROC S$ARCOMDEF generates EQUFs that define the SAR$ COM packet.<br />

The calling program may optionally attach an X-register and a B-register to these EQUFs.<br />

This allows the calling program to allocate storage space for the COM packet either<br />

statically at assembly time or dynamically at execution time.<br />

The calling program may display the EQUF labels by setting a display-flag parameter on<br />

the PROC call. This PROC also generates EQUs defining the COM packet current<br />

version and word length at the labels SC$CURVER and SA$PKTWLEN, respectively.<br />

Calling Format<br />

S$ARCOMDEF x-reg,b-reg,dispflg<br />

Parameters<br />

x-reg<br />

b-reg<br />

dispflg<br />

The X-register that is attached to the COM packet EQUFs. If it is omitted, no<br />

X-register is attached to the EQUFs.<br />

The B-register that is attached to the COM packet EQUFs. If it is omitted, no<br />

B-register is attached to the EQUFs.<br />

A flag that displays a table of the COM packet EQUFs. If it is set to 'D', the field<br />

names are displayed; otherwise the field names are not displayed.<br />

7833 1733–004 20–15


SAR$ COM<br />

Example<br />

$ASCII<br />

$INCLUDE ‘MAXR$’<br />

S$ARCOMDEF X6,B3,‘D’<br />

The PROC call S$ARCOMDEF generates EQUFs using registers X6 and B3 and displays<br />

a description of each packet field.<br />

20.2.1.5. SAR$ COM Packet Generation PROC (S$ARCOMPKT)<br />

The PROC S$ARCOMPKT generates a COM packet and reserves space for an image<br />

buffer, output text buffer, output attribute table, input text buffer, and input attribute<br />

table. S$ARCOMPKT also calls the S$ARCOMDEF PROC, defining the COM packet<br />

fields.<br />

Calling Format<br />

S$ARCOMPKT x-reg,b-reg,dispflg<br />

The parameters for S$ARCOMPKT are the same as for the S$ARCOMDEF PROC<br />

(see 20.2.1.4).<br />

Returns<br />

The S$ARCOMPKT PROC places values in the following fields of the COM packet:<br />

SA$PKTVER SA$IMGBUF SA$IMGBUFL<br />

SA$OTEXTBL SA$OATTRT SA$ITEXTB<br />

SA$ITEXTB SA$ATTRT SA$IATTRTL<br />

All other packet fields are set to default values.<br />

The generated buffers and tables use the default lengths (see Table 20–4). The<br />

following externalized labels are used to reference the buffers and tables:<br />

SCIMGBUF Image buffer<br />

SCOTEXTB Output text buffer<br />

SCOATTRT Output attribute table<br />

SCITEXTB Input text buffer<br />

SCIATTRT Input attribute table<br />

20–16 7833 1733–004


20.2.2. MASM SAR$ COM Procedure Buffers and Tables<br />

SAR$ COM<br />

All buffers and tables must be provided by the calling program. The buffers and tables<br />

for the COM function are similar to the buffers and tables for the READ and WRITE<br />

functions. See 17.1.2 and 18.1.2 for details on the buffers and tables. Note that for the<br />

COM function, the image buffer is not used if the input and output images do not have<br />

character attributes. The recommended lengths for the buffers and tables are equated<br />

to labels in the S$ARCOMDEF PROC. These lengths and labels are listed in Table 20–4.<br />

Table 20–4. SAR$: MASM COM Buffer and Table Lengths<br />

Label Value<br />

SC$IMGBUFDL (Image buffer word length) 25<br />

SC$TEXBUFDL (Text buffer byte length) 80<br />

SC$ATTRIBDL (Attribute table word length) 10<br />

SC$SELLSTDL (Select list byte length) 4<br />

20.2.3. SAR$ MASM COM Procedure Call (S$ARCOM)<br />

The MASM procedure for the SAR$ COM function is S$ARCOM. The S$ARCOM PROC<br />

constructs an image from the output text and output attributes and writes the image to<br />

the operator's console. If input is solicited from the operator, an image is read from the<br />

console, and the character text and attributes of the image are returned to the caller.<br />

Initial Conditions<br />

The calling program sets the following parameters in the COM packet to appropriate<br />

values before calling the S$ARCOM PROC:<br />

• Required parameters (described in 20.2.1.1)<br />

SC$PKTVER<br />

SC$ITEXTB<br />

SC$OTEXTB<br />

SC$ITEXTBL<br />

SC$OTEXTBL<br />

7833 1733–004 20–17


SAR$ COM<br />

• Optional parameters (described in 20.2.1.2)<br />

SC$OCHART<br />

SC$OATTRT<br />

SC$IATTRTL<br />

SC$REQTYPE<br />

SC$RUNIDW1<br />

SC$ROUTW2<br />

SC$IMGBUF<br />

SC$OATTRTL<br />

SC$ISLIST<br />

SC$CONSCLA<br />

SC$RUNIDW2<br />

SC$IMGBUFL<br />

SC$IATTRT<br />

SC$ISLISTL<br />

SC$CNTLB<br />

SC$ACNTLB<br />

SC$ROUTW1<br />

Calling Format<br />

S$ARCOM compkt<br />

error return<br />

normal return<br />

Returns<br />

If S$ARCOM takes the error return, A1 contains the call status code and A3 contains<br />

the substatus code. These status codes are also returned in the packet fields<br />

SC$CALLST and SC$SUBSTAT, respectively. See 20.2.4 for an explanation of the<br />

status codes.<br />

If S$ARCOM takes the normal return, the COM call is successful. The following<br />

information is returned by COM to the caller:<br />

• Character text<br />

The address of the character text and the length in 9-bit bytes (characters) are<br />

returned in the fields SC$ITEXTB and SC$TEXTLEN, respectively. The character<br />

set type of the image read is the same as the output character set type.<br />

• Attributes<br />

The address of the attribute table and the number of entries are returned in the<br />

fields SC$IATTRT and SC$NUMATTR, respectively.<br />

20–18 7833 1733–004


20.2.4. Status Lists for the MASM COM Procedure<br />

SAR$ COM<br />

The SAR$ COM procedure call status codes listed in Table 20–5 may be returned to the<br />

calling program in the SC$CALLST field of the COM packet. These call status codes are<br />

for SC$CURVER = 1 and above.<br />

Table 20–5. SAR$: COM Procedure SC$CALLST Status Codes<br />

Octal Code Status<br />

0 Normal return from the SAR$ COM procedure.<br />

01 An outdated SAR$ COM packet version is being used.<br />

02 An invalid SAR$ COM packet version is being used.<br />

03 The value for SC$IMGBUF is zero; an address must be given for the<br />

image buffer.<br />

04 The value for SC$IMGBUFL is zero; a length must be given for the<br />

image buffer.<br />

05 An invalid value is specified for SC$REQTYPE.<br />

06 An illegal character set type is specified for SC$OCHART.<br />

07 An illegal address is specified for SC$OTEXTB.<br />

010 The value for SC$OTEXTBL is zero; a length must be given for the<br />

output text buffer.<br />

011 An illegal address is specified for SC$ITEXTB.<br />

012 There are no valid characters in the output image.<br />

013 The input or output image is too long to fit in the image buffer. The<br />

image buffer word length necessary to hold the entire image is<br />

returned in the field SC$RECBUFL.<br />

014 The character text is too long to fit in the input text buffer and has<br />

been truncated. The text buffer byte length necessary to hold the<br />

character text is returned in the field SC$RECBUFL.<br />

015 The number of attributes is too large to fit in the input attribute<br />

table. The attribute table word length necessary to hold all the<br />

attributes is returned in the field SC$RECBUFL.<br />

016 An incorrect internal format to ACD translation routine version is<br />

being used.<br />

017 An incorrect ACD to internal format translation routine version is<br />

being used.<br />

020 The output attribute table contains an index that is either zero, not<br />

in sequential order, or greater than the output text length.<br />

021 The output attribute table contains an invalid attribute type or an<br />

invalid value for an attribute type.<br />

022 The image read contains incorrectly formatted ACD or incorrectly<br />

formatted embedded shift-coded kanji.<br />

7833 1733–004 20–19


SAR$ COM<br />

Table 20–5. SAR$: COM Procedure SC$CALLST Status Codes<br />

Octal Code Status<br />

023 The caller has illegally set a secured control bit in the SC$CNTLB<br />

field.<br />

024 The current Exec level does not allow ACD to be output or input<br />

with ER COM$.<br />

0100 An unrecognized error has occurred in an ACD subroutine. The<br />

ACD error code is returned in the SC$SUBSTAT field.<br />

0101 An unrecognized error has occurred in executing ER COM$. The<br />

COM$ error code is returned in the SC$SUBSTAT field.<br />

A SC$CALLST status code of 0100 or greater is a SAR$ internal error.<br />

20–20 7833 1733–004


Section 21<br />

SDFI, SDFO–System Data Format I/O<br />

Routines<br />

The System Data Format Input (SDFI) routine and the System Data Format Output<br />

(SDFO) routine are two independent routines that process files or elements that are in<br />

system data format (SDF).<br />

The SDFI routine reads SDF images from the input file or element and returns the<br />

images one at a time to the calling program. The SDFO routine takes SDF images one at<br />

a time from the calling program and writes the images to the output file or element.<br />

The SDFI and SDFO routines each require the following data structures:<br />

• A packet or file control table (FCT)<br />

• An image buffer<br />

• One or two I/O buffers<br />

An 11-word packet is used to pass information to and from SDFI and SDFO. The packet<br />

format for SDFI is described in 21.1.1. The packet format for SDFO is described in<br />

21.2.1.<br />

The image buffer is either the data area that SDFI reads the next image into or the data<br />

area containing the image that SDFO writes out.<br />

The I/O buffers are used by SDFI and SDFO to access the file or element. The I/O buffer<br />

length must be a multiple of 28 words (one sector). If there are two I/O buffers, they<br />

must be of equal length. Because the physical record size on disks is most frequently<br />

four sectors (112 words), SDFI and SDFO execute most efficiently when their buffer<br />

lengths are a multiple of 112 words. If the buffer length is larger than but not a multiple<br />

of 112 words, the excess length (28, 56, or 84 words) is not used in I/O operations<br />

unless the I/O device is a tape drive.<br />

If the file accessed by SDFI or SDFO is on tape, the buffer length should be the length of<br />

the tape block. The standard tape block length is 224 words. SDFI and SDFO can<br />

handle multireel tape files correctly. SDFI and SDFO send a message to the print device<br />

each time an input or output tape reel is swapped.<br />

SDFI and SDFO assume that the file being accessed is assigned to the run before SDFI<br />

and SDFO are called.<br />

7833 1733–004 21–1


SDFI, SDFO–System Data Format I/O Routines<br />

The SDFI and SDFO routines are available as relocatable elements and also in the<br />

<strong>SYSLIB</strong> common banks. SDFI is in the common bank absolute <strong>SYSLIB</strong>$3, and SDFO is<br />

in the common bank absolute <strong>SYSLIB</strong>$4. Both routines are reentrant. The relocatable<br />

and common bank entry points for SDFI and SDFO are listed in Appendix E.<br />

The following compatibility considerations apply to FURPUR and Processor Common<br />

Input/Output System (PCIOS):<br />

• SDFI and SDFO are fully compatible with FURPUR level 28R3 and higher levels.<br />

• SDFI and SDFO are compatible with PCIOS levels 4R1 and 4R1A, except for the<br />

handling of multireel tape files:<br />

− When SDFI reads multireel tape files created by PCIOS, I/O error 01 (unlabeled<br />

tape) or TLBL$ error 013 (labeled tape) occurs.<br />

− When PCIOS reads multireel tape files created by SDFO, unlabeled tapes are<br />

read correctly, but labeled tapes encounter I/O error 01.<br />

• SDFI returns segmented PCIOS records one segment at a time. The caller must<br />

examine the segment flag in the PCIOS data record control word to determine how<br />

the data record is segmented.<br />

A description of each routine and its corresponding packet is in the following<br />

subsections.<br />

For details on system data format, see the Data Structures <strong>Programming</strong> <strong>Reference</strong><br />

<strong>Manual</strong>.<br />

21.1. SDFI–System Data Format Input Routine<br />

The SDFI routine returns one SDF image at a time from an SDF file or element. SDFI<br />

has the following functions and entry points:<br />

• Open SDFI (SDFIO$, SDFIOA$)<br />

• Read an image (SDFI$, SDFINT$)<br />

• Close SDFI (SDFIC$)<br />

The calling program must open SDFI before reading images from the file or element and<br />

close SDFI after all images are read.<br />

The packet (or FCT) for SDFI is described in 21.1.1. The open, read, and close functions<br />

of SDFI are described in 21.1.2.1, 21.1.2.2, and 21.1.2.3, respectively.<br />

21.1.1. Packet<br />

The calling program must provide an 11-word packet for SDFI. The SDFI packet format<br />

is described in Figure 21–1. The packet may be generated with the S$DFCT procedure<br />

described in 21.1.1.2.<br />

21–2 7833 1733–004


SDFI, SDFO–System Data Format I/O Routines<br />

The same 11-word packet should not be used for both SDFI and SDFO.<br />

21.1.1.1. Packet Format<br />

The calling program must provide the eleven-word packet and place appropriate<br />

information in all fields with names in italics.<br />

0 internal filename<br />

1<br />

2 zero<br />

3 zero 020 reserved zero<br />

4 buffer length (words) single buffer address<br />

5 Relative Mass Storage Address (Sector)<br />

6 address of buffer number 1 address of buffer number 2<br />

7 buffer length (sectors) length of image area<br />

8 zero (used by SDFI) image area location<br />

9 zero (used by SDFI) image location in buffer (filled)<br />

10 SDF Control Word (filled)<br />

Packet Fields<br />

Words 0,1<br />

Figure 21–1. SDFI: Packet Format<br />

The 12-character Fieldata internal file name.<br />

Word 3 (S2)<br />

The I/O read function, R$ or 020.<br />

Word 4 (H1)<br />

The length in words of the I/O buffer used by SDFI.<br />

Word 4 (H2)<br />

The address of the I/O buffer if using one buffer.<br />

Word 5<br />

The mass storage sector address of the first SDF image to be read.<br />

7833 1733–004 21–3


SDFI, SDFO–System Data Format I/O Routines<br />

Word 6<br />

The addresses of the I/O buffers when two buffers are used. If only one buffer is<br />

used, this word must be zero, and the address of the single buffer must be put in<br />

word 4.<br />

Word 7 (H1)<br />

The length in sectors of the I/O buffers used by SDFI.<br />

Word 7 (H2)<br />

The length in words of the image buffer into which SDFI transfers the individual SDF<br />

images.<br />

Word 8 (H2)<br />

The address of the image buffer into which SDFI transfers the individual images.<br />

Word 9 (H2)<br />

The location in the I/O buffer of the next SDF image to be read (filled by SDFI).<br />

Word 10<br />

The SDF control word of the image read (filled by SDFI).<br />

SDFI may use one or two buffers. If SDFI uses one I/O buffer, that buffer address is<br />

stored in H2 of word 4. Word 6 must be set to zero. If SDFI uses two I/O buffers, the<br />

buffer addresses are placed in H1 and H2 of word 6. Words 0 through 5 are the<br />

standard I/O packet used by Executive Requests.<br />

21.1.1.2. Packet Generation PROC<br />

S$DFCT is a MASM procedure that generates the SDFI packet (or FCT). S$DFCT<br />

defines the fields of the packet, initializes the packet, and displays a diagram of the<br />

packet.<br />

The MASM definition element SDFP$ contains the S$DFCT procedure. This element<br />

must be included in the calling program in order to use the S$DFCT procedure. It is<br />

included by using the following MASM directive:<br />

$INCLUDE ‘SDFP$’<br />

21–4 7833 1733–004


SDFI, SDFO–System Data Format I/O Routines<br />

S$DFCT Calling Sequence<br />

There are two calling sequences for the S$DFCT procedure. The first call is used if the<br />

G-option is specified. The second call is used if the G-option is not specified.<br />

• Call 1 (G-option specified)<br />

label S$DFCT,o ifn,f,msa blw,buf1,buf2;<br />

ialng,ialoc w,x,l<br />

This call generates the packet definitions, initializes the packet, and displays the<br />

packet in the calling programs assembly.<br />

• Call 2 (G-option not specified)<br />

label S$DFCT,o w,x,l<br />

This call generates the packet definitions and displays the packet, but it does not<br />

initialize the packet.<br />

Parameters<br />

label<br />

o<br />

Prefix for field names (see L-option)<br />

Options (in quotes)<br />

D<br />

G<br />

L<br />

N<br />

S<br />

Display the packet diagram, including user-defined names.<br />

Generate packet from parameters on Call 1.<br />

Generate dynamic definitions using label on S$DFCT call as prefix for field<br />

names.<br />

Suppress listing of data while generating packet.<br />

Use standard field names (FCTxxxx) with or without word offset and index<br />

register.<br />

The S option is the default if neither the S nor L option is present. The L option<br />

overrides the S option if both the S and L options are present.<br />

7833 1733–004 21–5


SDFI, SDFO–System Data Format I/O Routines<br />

ifn<br />

f<br />

msa<br />

blw<br />

buf1<br />

buf2<br />

ialng<br />

ialoc<br />

w<br />

x<br />

l<br />

Internal file name (in quotes)<br />

I/O function code: R$ - Read (020)<br />

Mass storage address<br />

Buffer length in words<br />

Buffer address 1<br />

Buffer address 2 (optional). If not specified, the packet is generated for 1 buffer.<br />

Image area length<br />

Image area location<br />

Address on which to base definitions (word offset). If omitted, the current location is<br />

used.<br />

Index register for dynamic definitions<br />

Levels above calling point to which definitions are known.<br />

If omitted, main assembly is used. If specified, one level above the main assembly<br />

is the maximum allowed; otherwise the main assembly level is the maximum.<br />

If buf2 is not specified, S$DFCT generates the FCT using single buffering.<br />

21–6 7833 1733–004


SDFI, SDFO–System Data Format I/O Routines<br />

Example<br />

The following example generates the packet (FCT) for SDFI with the S$DFCT PROC:<br />

1. $ASCII<br />

2. $INCLUDE ‘MAXR$’<br />

3. $INCLUDE ‘SDFP$’<br />

4. $(2)<br />

5. PKT S$DFCT,‘DGL’ ‘TPF$’,R$,1792 448,BUF1,BUF2;<br />

6. 20,LINE ,X7<br />

7. BUF1 $RES 448<br />

8. BUF2 $RES 448<br />

9. LINE $RES 20<br />

.<br />

.<br />

.<br />

10. $(1)<br />

11. START<br />

12. L,U X7,PKT . Get address of packet<br />

.<br />

.<br />

.<br />

13. L A6,PKTICW . Get Image Control Word<br />

In this example, the packet (FCT) for SDFI is generated on line 5 by the S$DFCT PROC.<br />

The D option displays the packet in the MASM assembly. The G option initializes the<br />

packet with the information contained in the S$DFCT parameter fields 1, 2, and 3. The<br />

L option generates dynamic $EQUF definitions using the label field on the S$DFCT<br />

PROC and information in parameter field 4. In this case, the $EQUF labels are prefixed<br />

with 'PKT', use X-register X7, and are externalized to the main assembly level.<br />

Line 13 accesses word 10 of the SDFI packet using the $EQUF generated by the<br />

S$DFCT PROC.<br />

21.1.2. Calling Sequence<br />

The following subsections explain how to open the SDFI routine, read an image, and<br />

close the routine.<br />

21.1.2.1. Open SDFI<br />

The calling program must open SDFI before any images can be read. There are two<br />

entry points that perform the open function.<br />

SDFIO$ Open SDFI at sector address<br />

SDFIOA$ Open SDFI at sector address and word offset<br />

When the SDFIO$ entry point is called, SDFI fills the I/O buffer or buffers and tests if the<br />

file accessed is an SDF file. Reading begins at the sector address specified in word 5 of<br />

the packet.<br />

7833 1733–004 21–7


SDFI, SDFO–System Data Format I/O Routines<br />

The SDFIOA$ entry point is the same as SDFIO$ except that the calling program can<br />

specify a word offset into the initial read sector address. This allows SDFI to begin<br />

reading on a word boundary instead of a sector boundary. The word offset must be in<br />

the range of 0 through 27. If the word offset is 0, SDFIOA$ performs the same as<br />

SDFIO$.<br />

Calling Sequence for SDFIO$<br />

Auto Switch Common Bank or Relocatable Relocatable<br />

L,U A0,address-of-packet<br />

LMJ X11,CBSDFIO$-1<br />

error return<br />

normal return<br />

Calling Sequence for SDFIOA$<br />

L,U A0,address-of-packet<br />

I$BJ X11,CBSDFIO$<br />

error return<br />

normal return<br />

L,U A0,address-of-packet<br />

LMJ X11,SDFIO$<br />

error return<br />

normal return<br />

Auto Switch Common Bank or Relocatable Relocatable<br />

L,U A0,address-of-packet<br />

L A1,word-offset<br />

LMJ X11,CBSDFIOA$-1<br />

error return<br />

normal return<br />

L,U A0,address-of-packet<br />

L A1,word-offset<br />

I$BJ X11,CBSDFIOA$<br />

error return<br />

normal return<br />

L,U A0,address-of-packet<br />

L A1,word-offset<br />

LMJ X11,SDFIOA$<br />

error return<br />

normal return<br />

If SDFI takes the error return, register A4 contains the error code. See 21.3 for an<br />

explanation of error codes.<br />

If SDFI takes the normal return, SDFI is opened and ready to read images.<br />

21.1.2.2. Read an Image<br />

Each call to SDFI$ or SDFINT$ reads one image from the file or element. SDFI returns<br />

the image in the image buffer and returns the image control word (ICW) in word 10 of<br />

the packet. There are two entry points to read an image.<br />

SDFI$ read an image (truncation if image overflows image buffer)<br />

SDFINT$ read an image (no truncation)<br />

The only difference between SDFI$ and SDFINT$ is how they handle an image buffer<br />

overflow. The SDFI$ entry point truncates images that are too long to fit in the image<br />

buffer. The image buffer is filled, and the rest of the image is lost. SDFI returns the total<br />

length of the image in word 10 (T1) of the FCT if the image is truncated. Therefore, the<br />

caller may detect if an image was truncated by checking whether the image length<br />

returned in word 10 (T1) of the FCT is greater than the image buffer length.<br />

21–8 7833 1733–004


SDFI, SDFO–System Data Format I/O Routines<br />

The SDFINT$ entry point does not truncate images that overflow the image buffer but<br />

instead returns an error. The recommended image buffer word length is returned in<br />

register A5. To read the entire image, the calling program must place the address and<br />

word length of a larger image buffer in the packet and call SDFINT$ again. If a<br />

continuation record (051 in S1 of the ICW) causes an overflow, the image buffer will<br />

contain the part just read, and word 10 of the FCT will contain an ICW for the portion of<br />

the image returned in the image buffer. To continue reading the image, the calling<br />

program must call SDFINT$ again. SDFI will return the next portion of the image.<br />

SDFI processes continuation records (051 in S1 of the ICW) and does not return them to<br />

the calling program, unless the image being continued is a type 061 special print control<br />

record. Since the type 061 record may exceed 63 words in length, the special print<br />

control record will be returned, and each continuation record associated with that special<br />

print control record will be returned as a separate record. All other control records are<br />

returned to the calling program.<br />

Calling Sequence for SDFI$<br />

Auto Switch Common Bank or Relocatable Relocatable<br />

L,U A0,address-of-packet<br />

LMJ X11,CBSDFI$-1<br />

error return<br />

end-of-file return<br />

normal return<br />

Calling Sequence for SDFINT$<br />

L,U A0,address-of-packet<br />

I$BJ X11,CBSDFI$<br />

error return<br />

end-of-file return<br />

normal return<br />

L,U A0,address-of-packet<br />

LMJ X11,SDFI$<br />

error return<br />

end-of-file return<br />

normal return<br />

Auto Switch Common Bank or Relocatable Relocatable<br />

L,U A0,address-of-packet<br />

LMJ X11,CBSDFINT$-1<br />

error return<br />

end-of-file return<br />

normal return<br />

L,U A0,address-of-packet<br />

I$BJ X11,CBSDFINT$<br />

error return<br />

end-of-file return<br />

normal return<br />

L,U A0,address-of-packet<br />

LMJ X11,SDFINT$<br />

error return<br />

end-of-file return<br />

normal return<br />

Returns<br />

If SDFI takes the error return, register A4 contains the error code. See 21.3 for an<br />

explanation of error codes.<br />

If SDFI takes the end-of-file return, an end-of-file control record was encountered (077 in<br />

S1 of the ICW). If the file or element read by SDFI does not contain an EOF control<br />

record, SDFI does not terminate correctly.<br />

If SDFI takes the normal return, the image has been read and is returned in the image<br />

buffer.<br />

7833 1733–004 21–9


SDFI, SDFO–System Data Format I/O Routines<br />

21.1.2.3. Close SDFI<br />

After all the images are read, the calling program must close SDFI by calling the SDFIC$<br />

entry point. This completes the SDFI read operation.<br />

Calling Sequence for SDFIC$<br />

Auto Switch Common Bank or Relocatable Relocatable<br />

L,U A0,address-of-packet<br />

LMJ X11,CBSDFIC$-1<br />

normal return<br />

L,U A0,address-of-packet<br />

I$BJ X11,CBSDFIC$<br />

normal return<br />

L,U A0,address-of-packet<br />

LMJ X11,SDFIC$<br />

normal return<br />

21.2. SDFO–System Data Format Output Routine<br />

SDFO writes images one at a time from the calling program to an SDF file or element.<br />

SDFO has the following functions and entry points:<br />

• Open SDFO (SDFOO$, SDFOOSF$)<br />

• Write an image (SDFO$)<br />

• Close SDFO (SDFOC$)<br />

The calling program must open SDFO before writing images to the file or element and<br />

close SDFO after all images are written.<br />

The packet (or FCT) for SDFO is described in 21.2.1. The open, write, and close<br />

functions of SDFO are described in 21.2.2.1, 21.2.2.2, and 21.2.2.3, respectively.<br />

21.2.1. Packet<br />

The calling program must provide an 11-word packet for SDFO. The packet (or FCT) for<br />

SDFO is described in Figure 21–2. The packet may be generated with the S$DFCT<br />

procedure, described in 21.2.1.2.<br />

The same 11-word packet should not be used for both SDFI and SDFO.<br />

21–10 7833 1733–004


21.2.1.1. Packet Format<br />

SDFI, SDFO–System Data Format I/O Routines<br />

The calling program must provide the 11-word packet and place appropriate information<br />

in all fields with names in italics.<br />

0 internal filename<br />

1<br />

2 zero<br />

3 zero 010 reserved zero<br />

4 buffer length in words (filled) single buffer address<br />

5 Relative Mass Storage Address (Sector)<br />

6 address of buffer number 1 address of buffer number 2<br />

7 buffer length (sectors) length of image area (filled)<br />

8 zero image area location<br />

9 zero buffer image locator (filled)<br />

10 SDF Control Word<br />

Packet Fields<br />

Words 0,1<br />

Figure 21–2. SDFO: Packet Format<br />

The 12-character Fieldata internal file name.<br />

Word 3 (S2)<br />

The I/O write function, W$ or 010.<br />

Word 4 (H1)<br />

The length in words of the I/O buffer or buffers used by SDFO (filled by SDFO).<br />

Word 4 (H2)<br />

The address of the I/O buffer if using one buffer; otherwise zero.<br />

Word 5<br />

The mass storage sector address to start writing SDF images to.<br />

Word 6<br />

The addresses of the I/O buffers if using two buffers (in H1 and H2); otherwise zero.<br />

7833 1733–004 21–11


SDFI, SDFO–System Data Format I/O Routines<br />

Word 7 (H1)<br />

The length in sectors of the I/O buffer used by SDFO.<br />

Word 7 (H2)<br />

The length in words of the SDF image transferred from the image buffer (filled by<br />

SDFO).<br />

Word 8 (H2)<br />

The address of the image buffer containing the SDF image that SDFO writes out.<br />

Word 9 (H2)<br />

The location in the buffer that SDFO places the next image to be written out (filled<br />

by SDFO).<br />

Word 10<br />

The SDF control word of the image that SDFO writes out.<br />

SDFO may use one or two buffers. If SDFO uses one output buffer, that buffer address<br />

is stored in H2 of word 4. Word 6 must be set to zero.<br />

If SDFO uses two buffers, the buffer addresses are placed in H1 and H2 of word 6. H2<br />

of word 4 must be set to zero.<br />

SDF Image Control Word Formats<br />

The calling program must place an ICW in word 10 for each SDF data record or control<br />

record written out.<br />

SDFO does not automatically generate 051 continuation control records. These are<br />

generally found only in symbiont generated print files.<br />

The general format of the ICW for an SDF data record is as follows:<br />

image length (words) variable information<br />

0 1 11 12 35<br />

The general format of the ICW for an SDF control record is as follows:<br />

control code image length variable information<br />

0 5 6 11 12 35<br />

The ICW for SDF control records always has bit 0 set.<br />

SDF is described in the Data Structures <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

21–12 7833 1733–004


21.2.1.2. Packet Generation PROC<br />

SDFI, SDFO–System Data Format I/O Routines<br />

S$DFCT is a MASM procedure that generates the SDFO packet (or FCT). S$DFCT<br />

defines the fields of the packet, initializes the packet, and displays a diagram of the<br />

packet.<br />

The MASM definition element SDFP$ contains the S$DFCT procedure. This element<br />

must be included in the calling program in order to use the S$DFCT procedure by using<br />

the following MASM directive:<br />

$INCLUDE ‘SDFP$’<br />

S$DFCT Calling Sequence<br />

There are two calling sequences for the S$DFCT procedure. The first call is used if the<br />

G-option is specified. The second call is used if the G-option is not specified.<br />

• Call 1 (G-option specified)<br />

label S$DFCT,o ifn,f,msa blw,buf1,buf2;<br />

ialng,ialoc,icw w,x,l<br />

• Call 2 (G-option not specified)<br />

label S$DFCT,o w,x,l<br />

The first call generates the packet definitions, initializes the packet, and displays the<br />

packet in the calling program's assembly. The second call generates the packet<br />

definitions and displays the packet but does not initialize the packet.<br />

Parameters<br />

label<br />

o<br />

Prefix for field names (see L-option)<br />

Options (must be in quotes)<br />

D<br />

G<br />

L<br />

Display the packet diagram, including user-defined names.<br />

Generate packet from parameters on Call 1.<br />

Generate dynamic definitions using label on S$DFCT call as prefix for field<br />

names.<br />

7833 1733–004 21–13


SDFI, SDFO–System Data Format I/O Routines<br />

ifn<br />

f<br />

msa<br />

blw<br />

buf1<br />

buf2<br />

ialng<br />

ialoc<br />

icw<br />

N<br />

S<br />

Suppress listing of data while generating packet.<br />

Use standard field names (FCTxxxx) with or without word offset and index<br />

register.<br />

The S option is the default if neither the S nor L option is present. The L option<br />

overrides the S option if both the S and L options are present.<br />

Internal file name (in quotes)<br />

I/O function code:<br />

W$–Write (010)<br />

Mass storage address<br />

Buffer length in words<br />

Buffer address 1<br />

Buffer address 2 (optional). If not specified, the packet is generated for 1 buffer.<br />

Image area length<br />

Image area location<br />

Image control word<br />

21–14 7833 1733–004


w<br />

x<br />

l<br />

SDFI, SDFO–System Data Format I/O Routines<br />

Address on which to base definitions (word offset). If omitted, the current location is<br />

used.<br />

Index register for dynamic definitions<br />

Levels above calling point to which definitions are to be known.<br />

If omitted, main assembly is used. If specified, one level above the main assembly<br />

is the maximum allowed; otherwise the main assembly level is the maximum.<br />

If buf2 is not specified, S$DFCT generates the FCT using single buffering.<br />

Example<br />

The following example generates the packet (FCT) for SDFO with the S$DFCT PROC:<br />

1. $ASCII<br />

2. $INCLUDE ‘MAXR$’<br />

3. $INCLUDE ‘SDFP$’<br />

4. $(2)<br />

5. PKT S$DFCT,‘DGL’ ‘TPF$’,W$,1792 448,BUF1,BUF2;<br />

6. 20,LINE ,X7<br />

7. BUF1 $RES 448<br />

8. BUF2 $RES 448<br />

9. LINE $RES 20<br />

.<br />

.<br />

.<br />

10. $(1)<br />

11. START<br />

12. L,U X7,PKT . Get address of packet<br />

13. L A6,(0500130000001)<br />

14. S A6,PKTICW . Store label ICW<br />

.<br />

.<br />

.<br />

In this example, the packet (FCT) for SDFO is generated on line 5 by the S$DFCT PROC.<br />

The D option displays the packet in the MASM assembly. The G option initializes the<br />

packet with the information contained in the S$DFCT parameter fields 1, 2, and 3. The L<br />

option generates dynamic $EQUF definitions using the label field on the S$DFCT PROC<br />

and information in parameter field 4. In this case, the $EQUF labels are prefixed with<br />

'PKT', use X-register X7, and are externalized to the main assembly level.<br />

Line 13 and 14 store a label control record in the SDFO packet using the $EQUF<br />

generated by the S$DFCT PROC.<br />

7833 1733–004 21–15


SDFI, SDFO–System Data Format I/O Routines<br />

21.2.2. Calling Sequence<br />

The following subsections explain how to open the System Data Format Output routine,<br />

read an image, and close it.<br />

21.2.2.1. Open SDFO<br />

The calling program must open SDFO before any images can be written. There are two<br />

entry points that perform the open function.<br />

SDFOO$ Open SDFO for any file type<br />

SDFOOSF$ Open SDFO for a sector-formatted file<br />

When the SDFOO$ entry point is called, SDFO initializes the packet for writing to the file<br />

or element. If the output file type is known to be sector-formatted, the SDFOOSF$ entry<br />

point should be used. This entry point is the same as SDFOO$ except that SDFO does<br />

not need to perform an ER FITEM$.<br />

Calling Sequence for SDFOO$<br />

Auto Switch Common Bank or Relocatable Relocatable<br />

L,U A0,address-of-packet<br />

LMJ X11,CBSDFOO$-1<br />

normal return<br />

Calling Sequence for SDFOOSF$<br />

L,U A0,address-of-packet<br />

I$BJ X11,CBSDFOO$<br />

normal return<br />

L,U A0,address-of-packet<br />

LMJ X11,SDFOO$<br />

normal return<br />

Auto Switch Common Bank or Relocatable Relocatable<br />

L,U A0,address-of-packet<br />

LMJ X11,CBSDFOOSF$-1<br />

normal return<br />

L,U A0,address-of-packet<br />

I$BJ X11,CBSDFOOSF$<br />

normal return<br />

L,U A0,address-of-packet<br />

LMJ X11,SDFOOSF$<br />

normal return<br />

21–16 7833 1733–004


21.2.2.2. Write an Image<br />

SDFI, SDFO–System Data Format I/O Routines<br />

Each call to SDFO$ writes one image to the file or element. The calling program must<br />

supply the image and an ICW for the image. The calling program places the image in the<br />

image buffer and places the ICW in word 10 of the SDFO packet. SDFO combines the<br />

ICW and the image and places them in the I/O buffer to be written out.<br />

SDFO does not actually write an image to the file or element every time SDFO$ is called.<br />

SDFO places the images in the I/O buffer or buffers. When the buffer is filled or a call is<br />

made to SDFOC$ to close SDFO, the buffer is written out to the file or element.<br />

SDFO maintains the write address when writing to a file or element. The calling<br />

program only needs to specify the initial write address.<br />

Calling Sequence for SDFO$<br />

Auto Switch Common Bank or<br />

Relocatable<br />

L,U A0,address-of-packet<br />

LMJ X11,CBSDFO$-1<br />

error return<br />

normal return<br />

L,U A0,address-of-packet<br />

I$BJ X11,CBSDFO$<br />

error return<br />

normal return<br />

Relocatable<br />

L,U A0,address-of-packet<br />

LMJ X11,SDFO$<br />

error return<br />

normal return<br />

If SDFO takes the error return, register A4 contains the error code. See 21.3 for an<br />

explanation of error codes.<br />

If SDFO takes the normal return, the image has been successfully written to the file or<br />

element.<br />

21.2.2.3. Close SDFO<br />

After all images have been written, the calling program must close SDFO by calling the<br />

entry point SDFOC$. SDFO places an end-of-file control record (077 in S1 of the ICW) in<br />

the I/O buffer and writes the buffer out to the file or element. If SDFO is writing to mass<br />

storage, it returns a sector address in word 5. This is the next available address to write<br />

to in the file. If SDFO is writing to tape, an end-of-file mark is written to the tape.<br />

Calling Sequence for SDFOC$<br />

Auto Switch Common Bank or<br />

Relocatable<br />

L,U A0,address-of-packet<br />

LMJ X11,CBSDFOC$-1<br />

error return<br />

normal return<br />

L,U A0,address-of-packet<br />

I$BJ X11,CBSDFOC$<br />

error return<br />

normal return<br />

Relocatable<br />

L,U A0,address-of-packet<br />

LMJ X11,SDFOC$<br />

error return<br />

normal return<br />

7833 1733–004 21–17


SDFI, SDFO–System Data Format I/O Routines<br />

21.3. Error Return<br />

When SDFI or SDFO takes the error return, register A4 contains an error code. For<br />

some error codes, register A5 contains additional information. The error codes are as<br />

follows:<br />

00<br />

01<br />

04<br />

05<br />

06<br />

07<br />

Unrecoverable I/O error; A5 contains the status code (see the Exec ER <strong>Programming</strong><br />

<strong>Reference</strong> <strong>Manual</strong>).<br />

Error on ER TLBL$ tape label call; A5 contains the status code (see the Exec ER<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>).<br />

(SDFI entry point SDFINT$ only) The record that is read is larger than the image<br />

buffer; the record has been truncated. The recommended image buffer word length<br />

is returned in A5. Place the length and address of a larger image buffer in the packet<br />

and call SDFI$ again to read the entire image.<br />

(SDFI entry point SDFINT$ only) A continuation control record (051) made the total<br />

record length exceed the image buffer length; the record has been truncated. The<br />

recommended image buffer word length is returned in A5, and the word length of<br />

the partial image transferred is in S2 of word 10 for control records, and T1 of word<br />

10 for data records. Another call to SDFI$ will continue reading the image.<br />

(SDFI entry points SDFI$ and SDFINT$) A continuation control record (051) made the<br />

total record length exceed the maximum allowed word length (63 for control records,<br />

2047 for data records).<br />

(SDFO entry point SDFOC$ only) The code for the equipment type is zero. Either<br />

SDFO has not been opened correctly or the SDFO packet has been corrupted.<br />

21–18 7833 1733–004


Section 22<br />

SFDT$–System Standard Format Date<br />

and Time<br />

The System Standard Format Date and Time (SFDT$) editing routine provides the calling<br />

program with standard formats for dates and times. SFDT$ converts the current date<br />

and time (or a specified date and time) into a string of ASCII characters. This string is<br />

placed into a buffer provided by the calling program.<br />

SFDT$ can create separate date and time formats or combine them together. The date<br />

format can contain the century, year of century, month, day, abbreviation for month, and<br />

abbreviation for day. The time format can contain the hour, minute, second, and<br />

fractional second. The calling program determines the exact contents of the date and<br />

time formats by selecting a date index and a time index.<br />

There are eight standard date formats and three standard time formats to choose from.<br />

• Date Formats<br />

1. YYMMDD<br />

2. CCYYMMDD<br />

3. YY-MM-DD<br />

4. CCYY-MM-DD<br />

5. YY mmm DD<br />

6. CCYY mmm DD<br />

7. YY mmm DD ddd<br />

8. CCYY mmm DD ddd<br />

• Time Formats<br />

1. HHMM<br />

2. HHMM:SS<br />

3. HHMM:SS.FFF<br />

7833 1733–004 22–1


SFDT$–System Standard Format Date and Time<br />

where:<br />

CC<br />

YY<br />

MM<br />

DD<br />

mmm<br />

ddd<br />

HH<br />

MM<br />

SS<br />

FFF<br />

Two-digit decimal century<br />

Two-digit decimal year of century<br />

Two-digit decimal month<br />

Two-digit decimal day of month<br />

Three-ASCII-character abbreviation for month (see <strong>SYSLIB</strong> element SFDTBL$)<br />

Three-ASCII-character abbreviation for day of week (see <strong>SYSLIB</strong> element SFDTBL$)<br />

Two-digit decimal hour<br />

Two-digit decimal minute<br />

Two-digit decimal second<br />

Three-digit decimal fractional second (only significant digits included)<br />

The calling program can use the date and time formats individually or combine them.<br />

If they are combined, the date format precedes the time format, and the formats are<br />

separated by either a space character (" ") or a dash character ("-"). The space character<br />

separator may be used with all formats. The dash character separator may only be used<br />

with date formats 1 through 4.<br />

22–2 7833 1733–004


SFDT$–System Standard Format Date and Time<br />

Recommended Date and Time Formats<br />

Since there are many possible date and time format combinations, the following formats<br />

are recommended as standard:<br />

YYMMDD HHMM:SS format (1,2) –most compact<br />

CCYY-MM-DD HHMM:SS format (4,2)<br />

CCYY mmm ddd HHMM:SS format (8,2) –most descriptive<br />

The element SFDTBL$ contains the ASCII character abbreviations for months and days.<br />

It is accessed by external label SFDTBL$. These abbreviations may be changed to other<br />

abbreviations for months and days, for example, when using languages other than<br />

English.<br />

SFDT$ can be called from both MASM and PLUS routines. It is available as a relocatable<br />

element in the <strong>SYSLIB</strong> file (SYS$LIB$*<strong>SYSLIB</strong>) or SYS$*RLIB$ and in the <strong>SYSLIB</strong><br />

common bank <strong>SYSLIB</strong>$1. The relocatable and common bank entry points to SFDT$ are<br />

listed in Appendix E.<br />

22.1. MASM Interface<br />

SFDT$ can be called directly from MASM programs. The packet for SFDT$ is described<br />

in 22.1.1. The calling sequence for SFDT$ is described in 22.1.2.<br />

22.1.1. Packet<br />

The calling program must provide a five-word packet for SFDT$. The following MASM<br />

PROC generates this packet:<br />

label S$FDTPKT datefmt,timefmt,buflen,bufaddr[,sep][,offset]<br />

The packet is shown in Figure 22–1.<br />

0 tscell datefmt timefmt sep reserved version<br />

01 offset numchar buflen errcode<br />

02 bufaddr<br />

03 date<br />

04 time<br />

Figure 22–1. SFDT$: Packet Format<br />

7833 1733–004 22–3


SFDT$–System Standard Format Date and Time<br />

Packet Fields<br />

The calling program provides the fields in italics.<br />

tscell<br />

datefmt<br />

Available to the calling program as a test-and-set flag (optional).<br />

The date format index (0 through 8) (required). It corresponds to the date formats<br />

listed at the beginning of this section. If set to zero, no date format is used; only the<br />

time is formatted.<br />

timefmt<br />

sep<br />

The time format index (0 through 3) (required). If set to zero, no time format is used;<br />

only the date is formatted.<br />

A flag for which separator character to use (optional)<br />

0 Space (" ") character (default)<br />

1 Dash ("-") character<br />

version<br />

offset<br />

The packet version number; the current version is 1 (required).<br />

The character offset within the first word (0, 1, 2, or 3) of the SFDT$ output<br />

(optional). If omitted, it defaults to zero. SFDT$ also returns the position of the last<br />

nonspace character (0, 1, 2, or 3) in this field.<br />

numchar<br />

buflen<br />

errcode<br />

bufaddr<br />

The number of characters that SFDT$ writes to the output buffer.<br />

The length in words of buffer specified by bufaddr (required).<br />

A negative error code returned by SFDT$ when the error return is taken.<br />

The address of SFDT$ output buffer (required).<br />

22–4 7833 1733–004


date<br />

time<br />

SFDT$–System Standard Format Date and Time<br />

The date and time in TDATE$ format (optional). The default is the current date and<br />

time.<br />

The time in TIME$ format (optional). The default is the current time.<br />

Parameters datefmt, timefmt, buflen, and bufaddr are required; sep is optional and is set<br />

to zero (space separator) if omitted; offset is optional and is set to zero if omitted.<br />

Output Buffer<br />

The SFDT$ packet and the buffer to contain the ASCII string must be in the same<br />

D-bank. This D-bank must be based when SFDT$ is called.<br />

The caller-provided buffer must be large enough to hold the ASCII string generated by<br />

the specified format. If not, the ASCII string is truncated to the length of the buffer<br />

(buflen), and the error return is taken. If the buffer length is greater than the format<br />

length, the buffer is space-filled to the end of the buffer.<br />

22.1.2. Calling Sequence<br />

SFDT$ is called with the MASM PROC S$FDT$. This PROC can call SFDT$ as a<br />

relocatable element, a common bank element, or a common bank element using the<br />

auto-switch method.<br />

Calling Format<br />

S$FDT$[,t] pktaddr [date] [time]<br />

error return<br />

normal return<br />

Parameters<br />

t<br />

The type of call to SFDT$. This parameter is optional and may be omitted. CB or A,<br />

if specified, must be enclosed by apostrophes.<br />

blank Call the relocatable version of SFDT$. This is the default if t is omitted.<br />

'CB' Call the common bank version of SFDT$.<br />

'A' Call the common bank version of SFDT$ using the auto switch method.<br />

pktaddr<br />

The address of the five-word SFDT$ packet.<br />

7833 1733–004 22–5


SFDT$–System Standard Format Date and Time<br />

date<br />

time<br />

The address of a caller-specified date and time (must be in TDATE$ format). This<br />

parameter is optional.<br />

The address of a caller-specified time (must be in TIME$ format). This parameter is<br />

optional.<br />

If date or time are not included on the calling statement, the current date and time (from<br />

ER TDATE$, or current time from ER TIME$ for time format 3) is used. The calling<br />

program can use indexing, incrementation, and indirect addressing in specifying the<br />

addresses for pktaddr, date, or time, by using the $EQUF directive. See $EQUF<br />

definitions in the MASM <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

Returns<br />

If the normal return is taken, SFDT$ has stored the ASCII date/time string in the buffer.<br />

The following information is returned to the caller in registers A0 to A3 and also stored in<br />

the packet at the appropriate locations:<br />

A0 The address of the SFDT$ packet<br />

A1 The number of characters in the formatted ASCII string<br />

A2 The address of the buffer containing the ASCII string<br />

A3 The character offset of the last nonspace character<br />

If the error return is taken, register A0 contains the packet address, and register A1<br />

contains the negative error code (also stored in the packet field errcode).<br />

1 The buffer length is too short for specified format(s).<br />

2 The date format index is out of range.<br />

3 The time format index is out of range.<br />

4 Both date and time formats are zero.<br />

5 An outdated version of the SFDT$ packet is being used.<br />

22–6 7833 1733–004


22.1.3. Example<br />

SFDT$–System Standard Format Date and Time<br />

The following example generates the packet for SFDT$ and calls SFDT$ from a MASM<br />

routine:<br />

1. $(0)<br />

2. PACKET S$FDTPKT 8,2,LINELEN,LINE<br />

3. LINELEN $EQU 7<br />

4. LINE $RES LINELEN<br />

.<br />

.<br />

.<br />

5. $(1)<br />

6. START<br />

.<br />

.<br />

.<br />

7. S$FDT$,‘CB’ PACKET . Format the date and time<br />

In this example, lines 2 through 4 generate the packet for SFDT$. Date format 8 and<br />

time format 2 are used, and the date/time string will be placed in the seven-word buffer<br />

LINE. The separator character and the offset default to a space and zero, respectively.<br />

Line 7 calls the common bank version of SFDT$ to format an ASCII string of the current<br />

date and time.<br />

7833 1733–004 22–7


SFDT$–System Standard Format Date and Time<br />

22.2. PLUS Interface<br />

SFDT$ can be called directly from PLUS programs. The packet for SFDT$ is described in<br />

22.2.1. The calling sequence for SFDT$ is described in 22.2.2.<br />

22.2.1. Packet<br />

Required Data Structures<br />

SFDT$ requires a five-word packet and a seven-word (or less) buffer area. The packet<br />

passes parameters to SFDT$ and the buffer area contains the ASCII date/time string<br />

generated by SFDT$. These data structures are defined as follows:<br />

DEFINE TYPE SFDT_BUFFER = 28 ASCII CHARACTERS LOCATABLE;<br />

DEFINE TYPE SFDT_PACKET = MAPPED LOCATABLE<br />

[*: LOGICAL(6),<br />

SFDT_DATE_FORMAT: 6 BIT INTEGER,<br />

SFDT_TIME_FORMAT: 6 BIT INTEGER,<br />

SFDT_SEPARATOR: 6 BIT STATUS (S’SPACE’:0, S’DASH’:1),<br />

*: LOGICAL(6),<br />

SFDT_PACKET_VERSION: 6 BIT INTEGER,<br />

SFDT_CHAR_OFFSET: 6 BIT INTEGER,<br />

SFDT_BUFFER_LENGTH: 6 BIT INTEGER,<br />

SFDT_NUMBER_CHAR: 6 BIT INTEGER,<br />

SFDT_ERROR_CODE: 18 BIT SIGNED INTEGER,<br />

SFDT_BUFFER_ADDRESS: 36 BIT MACHINE POINTER,<br />

SFDT_DATE: 36 BIT MACHINE LOGICAL,<br />

SFDT_TIME: 36 BIT MACHINE LOGICAL];<br />

The calling program can use these data types to set up the necessary data entities for<br />

SFDT$. For example<br />

DECLARE buffer: SFDT_BUFFER;<br />

DECLARE pkt: SFDT_PACKET;<br />

where:<br />

buffer<br />

pkt<br />

An identifier of a buffer that SFDT$ places the ASCII date/time string into.<br />

An identifier of a data entity that passes information to SFDT$.<br />

The type definitions for SFDT_BUFFER and SFDT_PACKET are available in PLUS COPY<br />

elements (see 22.2.2).<br />

22–8 7833 1733–004


SFDT$–System Standard Format Date and Time<br />

Parameters<br />

The calling program must set the following variables before calling SFDT$:<br />

SFDT_DATE_FORMAT<br />

Specifies date format (0 through 8). If set to zero, no date format is used; only the<br />

time is formatted.<br />

SFDT_TIME_FORMAT<br />

Specifies time format (0 through 3). If set to zero, no time format is used; only the<br />

date is formatted.<br />

SFDT_SEPARATOR<br />

Specifies space separator (" ") between formats if set to S'Space', and dash<br />

separator ("-") if set to S'Dash'.<br />

SFDT_PACKET_VERSION<br />

Specifies the SFDT$ packet version (the current version is 1).<br />

SFDT_CHAR_OFFSET<br />

The character offset (0, 1, 2, or 3) in the first word at which to start the ASCII<br />

date/time string.<br />

SFDT_BUFFER_LENGTH<br />

Specifies the length in words of the buffer into which the string is placed.<br />

SFDT_BUFFER_ADDRESS<br />

Specifies a pointer to the buffer into which the string is placed.<br />

SFDT_DATE<br />

Value for date; may be assigned a negative integer to use current date or assigned a<br />

positive integer or octal string value if a date other than the current date is desired<br />

(must be in TDATE$ format).<br />

SFDT_TIME<br />

Value for time; may be assigned a negative integer to use current time or assigned a<br />

positive integer or octal string value if a time other than the current time is desired<br />

(must be in TIME$ format).<br />

7833 1733–004 22–9


SFDT$–System Standard Format Date and Time<br />

Initialization Procedure<br />

The calling program may use the following procedure to set these variables in the SFDT$<br />

packet:<br />

PROCEDURE SFDT_INITIALIZE(%PACKET: SFDT_PACKET,<br />

INIT_DATE_FORMAT: 6 BIT INTEGER,<br />

INIT_TIME_FORMAT: 6 BIT INTEGER,<br />

INIT_SEPARATOR: 6 BIT STATUS (S’SPACE’:0,<br />

S’DASH’:1),<br />

INIT_CHAR_OFFSET: 6 BIT INTEGER,<br />

INIT_BUFFER_LENGTH: 6 BIT INTEGER,<br />

INIT_BUFFER_ADDRESS: 36 BIT MACHINE POINTER,<br />

INIT_DATE: 36 BIT MACHINE LOGICAL,<br />

INIT_TIME: 36 BIT MACHINE LOGICAL);<br />

BEGIN<br />

PACKET.SFDT_DATE_FORMAT:= INIT_DATE_FORMAT;<br />

PACKET.SFDT_TIME_FORMAT:= INIT_TIME_FORMAT;<br />

PACKET.SFDT_SEPARATOR:= INIT_SEPARATOR;<br />

PACKET.SFDT_CHAR_OFFSET:= INIT_CHAR_OFFSET;<br />

PACKET.SFDT_BUFFER_LENGTH:= INIT_BUFFER_LENGTH;<br />

PACKET.SFDT_BUFFER_ADDRESS:= INIT_BUFFER_ADDRESS;<br />

PACKET.SFDT_DATE:= INIT_DATE;<br />

PACKET.SFDT_TIME:= INIT_TIME;<br />

PACKET.SFDT_PACKET_VERSION:= 1;<br />

END;<br />

The SFDT_INITIALIZE procedure is defined in a PLUS COPY element (see 22.2.2).<br />

For example, the following call will initialize the data entity 'pkt' for date format 4 and<br />

time format 2, which are separated by a dash.<br />

SFDT_INITIALIZE(%pkt,4,2,S’Dash’,0,5,LOC(buffer),TEST_DATE,-1);<br />

These formats start in Q1 of the first word of the buffer; the buffer length is five words<br />

and is stored in buffer using the date stored at TEST_DATE and the current time.<br />

Returns<br />

SFDT$ returns string length in SFDT_NUMBER_CHAR, the offset of the last character<br />

(0, 1, 2, or 3) in SFDT_CHAR_OFFSET, and the error code, if any, in<br />

SFDT_ERROR_CODE.<br />

22–10 7833 1733–004


22.2.2. Calling Sequence<br />

SFDT$–System Standard Format Date and Time<br />

Calling programs need the following procedure declaration to call SFDT$:<br />

PROCEDURE STANDARD_DATE_TIME(%SFDT_PKT_ADDR: SFDT_PACKET)<br />

IMPORTED (‘external-name’);<br />

The external-name may be one of two entry points to SFDT$.<br />

SFDT$P This entry point uses the relocatable version of SFDT$.<br />

SFDT$PG This entry point uses the common bank version of SFDT$.<br />

The type definitions for SFDT_BUFFER and SFDT_PACKET, the initialization procedure<br />

SFDT_INITIALIZE, and the procedure definition for STANDARD_DATE_TIME are available<br />

in elements SFDT$D and SFDT$DG in the <strong>SYSLIB</strong> file SYS$LIB$*<strong>SYSLIB</strong>. Element<br />

SFDT$D contains the definitions to call the relocatable version of SFDT$, and SFDT$DG<br />

contains the definitions to call the common bank version of SFDT$.<br />

These elements are obtained with the COPY statement as follows:<br />

COPY(‘elt-name’);<br />

where elt-name may be SFDT$D or SFDT$DG.<br />

SFDT$ Calling Format<br />

STANDARD_DATE_TIME(%pkt);<br />

where pkt is the identifier of a data entity of type SFDT_PACKET.<br />

Returns<br />

If no error occurs, SFDT$ creates the ASCII date/time format string and returns it in the<br />

buffer specified by the calling program.<br />

SFDT$ returns the following variables to the calling program:<br />

SFDT_CHAR_OFFSET<br />

Position in word of the last nonspace character of the ASCII string (0, 1, 2, or 3).<br />

SFDT_NUMBER_CHAR<br />

The number of characters in the string.<br />

7833 1733–004 22–11


SFDT$–System Standard Format Date and Time<br />

SFDT_ERROR_CODE<br />

22.2.3. Example<br />

Negative error code if an error occurs:<br />

1 The buffer length is too short for specified format(s).<br />

2 The date-format index is out of range.<br />

3 The time-format index is out of range.<br />

4 Both date and time formats are zero.<br />

5 An outdated version of the SFDT$ packet is being used.<br />

The following example calls the relocatable version of SFDT$ from a PLUS program to<br />

return the date and time as an ASCII character string.<br />

module;<br />

copy ( ‘sfdt$dg’ );<br />

declare line: sfdt_buffer;<br />

declare pkt: sfdt_packet;<br />

sfdt_initialize ( %pkt, 8, 3, s’space’, 0, 7, loc( line ), -1, -1 );<br />

standard_date_time ( %pkt );<br />

open file ‘sysprint’ stream output;<br />

put file ‘sysprint’ edit ( line ) ( skip, a(28), skip );<br />

close file ‘sysprint’ ;<br />

term<br />

This will store the ASCII string for date format 8 and time format 2, which are separated<br />

by a space. These formats start in Q3 of the first word using current date and time in<br />

the buffer DATE_AND_TIME_LINE. They are six words long.<br />

22.3. SFDTBL$–Month and Day Table<br />

SFDTBL$ is a table of three ASCII character abbreviations for the months of the year and<br />

days of the week. SFDTBL$ is used by the standard date/time routines as a separate<br />

element. The ASCII characters can then be changed easily to incorporate user-defined<br />

abbreviations. Each abbreviation uses one word of storage, with a blank as the fourth<br />

character of the word.<br />

22–12 7833 1733–004


Section 23<br />

SIR$–Symbolic Input/Output Routine<br />

The Symbolic Input/Output Routine (SIR$) performs input, output, and updating on<br />

system data format (SDF) files. Processors call SIR$ to read symbolic input from<br />

• A runstream<br />

• A symbolic element in a program file<br />

• An SDF file<br />

SIR$ can update the symbolic input from an element or file with input from the<br />

runstream.<br />

After reading symbolic input and possibly updating it, the SIR$ routine can write<br />

symbolic output to<br />

• A symbolic element in a program file<br />

• An SDF file<br />

The general capabilities of SIR$ are described in this subsection. The entry points and<br />

functions of SIR$ are described in 23.2.<br />

When reading symbolic input, SIR$ automatically merges correction images and<br />

produces an updated symbolic element that is inserted into a program file. The symbolic<br />

element that contains the symbolic input may be cycled by specifying the desired cycle<br />

in the processor call statement. SIR$ automatically passes to the processor only those<br />

images that pertain to the cycle requested.<br />

Symbolic images can be in any of the coded character sets (CCS) listed in Appendix H.<br />

SIR$ normally handles images in the following CCSs:<br />

• Fieldata images.<br />

• ASCII images. Identified as ASCII_ISO, octal code 01, in Table H–1.<br />

• ASCII-like images. There are 39 CCSs listed in Table H–1 that are defined as being<br />

ASCII-like, or essentially identical to the ASCII_ISO character set for characters in the<br />

octal range of 0000 through 0177.<br />

SIR$ can optionally be initialized to handle, with some restrictions, images in an<br />

additional 22 CCSs. These 22 CCSs are referred to as “other CCSs” in the remainder of<br />

the SIR$ section. This allows SIR$ to process images in all 63 legal CCSs. Note that<br />

CCS octal 076 is reserved for future use and is currently illegal.<br />

7833 1733–004 23–1


SIR$–Symbolic Input/Output Routine<br />

The information for symbolic input and output elements or files (for example, their<br />

names) is obtained from the entries in PARTBL. The information in PARTBL is usually<br />

produced by the PREPRM and PREPRO (see 14.1.1) or PREPF$ (see 14.2) routines from<br />

information specified on the processor call statement.<br />

Some options placed on a processor call statement affect the SIR$ routine. These<br />

options are listed in 23.1.<br />

Depending on which options are specified, SIR$ is directed to<br />

• Write images in Fieldata, ASCII, or without translation.<br />

• Read and check sequence numbers.<br />

• Create symbolic elements from the runstream.<br />

• Update and produce new element cycles.<br />

• List runstream line change statements and change images.<br />

SIR$ reads, processes and writes system data format (SDF) images.<br />

SDF data images from the source input element or file have implicit, sequential line<br />

numbers, beginning with 1. The numbers on runstream correction images refer to the<br />

source input line numbers.<br />

SDF control images in the source input may be passed to the calling program, but the<br />

control images do not have line numbers and do not affect the line numbering of the<br />

source input data images.<br />

See the Data Structures <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for a description of SDF data<br />

images and control images. See the ECL and FURPUR <strong>Reference</strong> <strong>Manual</strong> for a<br />

description of runstream correction images.<br />

Note the following CCS-related restrictions on runstream correction images:<br />

• Runstream line change statements (-n and -n,m), partial line change statements<br />

(-n- and -n,m-) and partial line change editing statements (c/new-data, c,d/new-data/,<br />

/old-data/new-data and /old-data/new-data/) must be Fieldata, ASCII, or ASCII-like<br />

images.<br />

• Runstream partial line change statements (-n- and -n,m-) can only be used to edit<br />

source input images that are Fieldata, ASCII or ASCII-like. That is, source input line n<br />

(first format) or lines n through m (second format) must be Fieldata, ASCII, or<br />

ASCII-like images.<br />

• The CCS of a source input image does not change when it is edited by a partial line<br />

change statement and partial line change editing statements.<br />

• When the partial line change editing statements (c/new-data, c,d/new-data/,<br />

/old-data/new-data, and /old-data/new-data/) are in a different ASCII-like CCS than the<br />

source input image being edited, differences in the graphic representation of<br />

characters may affect the results of SIR$ editing operations.<br />

23–2 7833 1733–004


SIR$–Symbolic Input/Output Routine<br />

Different ASCII-like CCSs often have different graphic characters associated with an<br />

octal value, particularly for octal values of 0200 and over. Conversely, there are<br />

cases where characters in different ASCII-like CCSs have identical graphic<br />

representations but have different octal values. Of particular note in this case are<br />

certain special characters in the ASCII-like ISO 646 CCSs (decimal CCS 17 through<br />

28). For example, the small letter “c” with the cedilla diacritical mark is represented<br />

by the octal value 0134 in ISO_646_Italy (decimal CCS 22); the octal value 0175 in<br />

ISO_646_Spain (decimal CCS 23); and the octal value 0347 in ISO_8859_2 (decimal<br />

CCS 36).<br />

SIR$ character comparisons and replacements are always based on the octal values<br />

of characters in the runstream partial line editing statement and in the source input<br />

image, never on their graphic representation. As a result<br />

− Old-data characters that graphically match a source input image string may result<br />

in an unexpected SIR$ “no find.”<br />

− Old-data characters that do not appear to match a source input image string may<br />

result in an unexpected SIR$ “find.”<br />

− New-data characters may not have the same graphic representation once they<br />

are placed into the source input image.<br />

• Runstream images in CCSs other than Fieldata, ASCII, or ASCII-like can only<br />

represent images to be inserted into the source output following a “-n” line change<br />

statement or images to replace source input images following a “-n,m” line change<br />

statement.<br />

When an updated or new symbolic element is specified on the processor call statement,<br />

the updated or new symbolic is written to the program file. If a two-pass processor call<br />

is made to SIR$ and an update element is not specified on the processor call statement,<br />

the processor must provide a scratch file to hold the updated symbolic for the second<br />

pass. GETPSF$ can be called to get the scratch file. The internal file name of the<br />

scratch file must be in PARTBL+14,15 and PARTBL+16 must be set to zero prior to<br />

entering SIR$.<br />

To read from and write to an SDF file, PARTBL + 16,17 and PARTBL + 29,30 must be<br />

set to zero.<br />

Label Control Record<br />

Whenever symbolic output is written by SIR$, a label control record is the first image<br />

written. The format of the label control record created by SIR$ is the following.<br />

0 5 6 11 12 17 18 29 30 35<br />

0 050 01 030 CCS<br />

1 *SDFF*<br />

7833 1733–004 23–3


SIR$–Symbolic Input/Output Routine<br />

Word 0<br />

S1<br />

S2<br />

S3<br />

S6<br />

050 is the SDF label identifying this as an SDF element.<br />

indicates that a 1-word image follows.<br />

the Fieldata character 'S' identifies this as an SIR$-created file or element.<br />

indicates the CCS of the data records that follow (see Appendix H).<br />

If SIR$ writes a source output element, the element is identified as a Fieldata element if<br />

the label control record CCS is zero; otherwise, it is identified as an ASCII element.<br />

SIR$ Line-Change Control Record<br />

When SIR$ applies runstream corrections to the source input, SIR$ line-change control<br />

records are written to the source output and passed to the calling program. Note that<br />

these are control records that SIR$ writes to the source output; if SIR$ line-change<br />

control records are read in the source input, they are discarded by SIR$.<br />

SIR$ produces two types of SIR$ line-change control records, both of which may be<br />

present in source output produced by SIR$.<br />

The first type contains the actual text of the runstream line change statement or partial<br />

line change statement. It is used primarily by processors when producing<br />

comprehensive 'V' option listings of source input line numbers and runstream<br />

corrections. The control record format follows.<br />

0 5 6 11 18 35<br />

0 052 n 0<br />

1 line-change statement<br />

..<br />

n<br />

23–4 7833 1733–004


Word 0<br />

S1<br />

S2<br />

H2<br />

052 indicates that this is an SIR$ line-change control record.<br />

SIR$–Symbolic Input/Output Routine<br />

n specifies the length of the line change statement or partial line change statement<br />

in words 1 through n.<br />

Zero.<br />

When this control record is written to the source output and passed to the calling<br />

program, the CCS of the line change statement image is processed identically to a<br />

runstream data image of the same CCS.<br />

The SIR$ line-change control record for a -n line change statement is written to the<br />

source output immediately after source input line n. The SIR$ line-change control record<br />

for a -n,m line-change statement or for a -n- or -n,m- partial line change statement is<br />

written to the source output immediately after source input line n-1.<br />

The second type of SIR$ line-change control record is used internally by SIR$ and is not<br />

directly passed to the calling program. This control record is written by SIR$ whenever<br />

source input images are deleted by runstream corrections. The record contains a count<br />

of the number of source input images deleted immediately before the source input<br />

image that follows this control record. On the second and subsequent passes, SIR$<br />

uses this control record to calculate source input line number and source input image<br />

deletion information that is returned to the calling program. The control record format<br />

follows.<br />

0 5 6 11 18 35<br />

0 052 0 number-of-images-deleted<br />

Word 0<br />

S1<br />

S2<br />

H2<br />

052 indicates that this is an SIR$ line-change control record.<br />

Zero.<br />

The number of source input images deleted immediately before the next source<br />

input image.<br />

7833 1733–004 23–5


SIR$–Symbolic Input/Output Routine<br />

Data Record<br />

The first word of each data record is the image control word. For data records written by<br />

SIR$, the format of the image control word is as follows:<br />

0<br />

0 1 11 12 17 18 23 24 29 30 35<br />

0<br />

image length<br />

(words)<br />

previous images<br />

deleted flag<br />

delete cycle<br />

number<br />

new images flag<br />

start cycle<br />

number<br />

S6 is the element cycle at which the image was added; S4 is the cycle at which it was<br />

deleted. If the image is added on the latest cycle (after cycle zero), the new flag is set.<br />

The calling processor marks the line as "NEW". If this is not a new image and any<br />

previous images were deleted on the cycle, S3 is nonzero.<br />

When the symbolic input is from a FURPUR-formatted element file, the tape label block<br />

is read prior to entering SIR$. SIR$ then treats it as a program-file element. After SIR$<br />

is closed, the tape is positioned in front of the new element label block.<br />

SIR$ contains its own D-bank; however, all D-bank references in SIR$ are made using<br />

index registers. This allows the SIR$ D-bank to be located above the 65K addressing<br />

boundary.<br />

23.1. SIR$–Control Options<br />

SIR$ uses options to control the input and output of the symbolic elements. Most of the<br />

Unisys language processors (FTN, MASM, ACOB, NUALG, etc.) and system processors<br />

(DATA, ELT, PDP, and Collector) use the SIR$ routine to obtain input. The following<br />

options are available in most language system processors:<br />

G<br />

H<br />

I<br />

Input is compressed symbolic in columns 1 through 80 of the symbolic images.<br />

Applies only with I option.<br />

Input contains sequence numbers in columns 73 through 80 of the images. Applies<br />

only with I option.<br />

Read images from the runstream and insert them into a new symbolic. If the I<br />

option is present without any source input (SI) specification, SIR$ reads images from<br />

the runstream and passes them to the caller. In this case, if the calling program is a<br />

multipass processor, a scratch file (usually PSF$) must be provided so that the<br />

source images can be processed on the second and subsequent passes.<br />

23–6 7833 1733–004


J<br />

K<br />

SIR$–Symbolic Input/Output Routine<br />

Input contains compressed symbolic images in columns 1 through 72 of the images<br />

and sequence numbers in columns 73 through 80. These sequence numbers are<br />

not checked by either the J option or the K option. Applies only with the I option.<br />

Check sequence numbers in columns 73 through 80 of the symbolic images (valid<br />

only with H and I options).<br />

P and Q<br />

U<br />

W<br />

The P and Q options are used in combination to specify the CCSs of source output<br />

images produced by SIR$. A detailed description of source output operations<br />

follows this list of options.<br />

Read change images from the runstream, apply them to the symbolic input element,<br />

and produce a new cycle of the symbolic element.<br />

List line-change statements and change images.<br />

SIR$ Source Output<br />

When the source output portion of PARTBL (Words 14 through 26) has been filled by the<br />

calling program, SIR$ produces a source output file or element. When the I option is<br />

specified, the source output is created from runstream images. When the I option is not<br />

specified, the source output is created from source input images, possibly modified by<br />

corrections contained on runstream images.<br />

The CCS of images in the source output is controlled by the various combinations of the<br />

P and Q options and by the CCS of the images in the source input and the runstream.<br />

In general, the P option requests Fieldata source output, the Q option requests ASCII<br />

source output, and both the P and Q options request source output without translation.<br />

7833 1733–004 23–7


SIR$–Symbolic Input/Output Routine<br />

The following table lists SIR$ source output operations in greater detail. The columns of<br />

the table list the P option, the Q option, and both the P and the Q options. Note that the<br />

"neither P nor Q option" case is discussed later in this section. There are separate rows<br />

in the table for input images in Fieldata, ASCII, ASCII-like CCSs, the 22 "other" CCSs, and<br />

the illegal CCS. The input image may originate in either the runstream or the source<br />

input. The intersection of the columns and rows is the SIR$ source output action with<br />

this combination of options and input image CCS type.<br />

Input Image Type<br />

P Option<br />

Fieldata Unchanged<br />

Fieldata image<br />

ASCII Translated to<br />

Fieldata image<br />

ASCII-like Translated to<br />

Fieldata image<br />

"Other CCS" Error; image<br />

not written<br />

Illegal CCS Error; image<br />

not written<br />

Q Option<br />

Translated to<br />

ASCII_ISO<br />

image<br />

Unchanged<br />

ASCII image<br />

Unchanged<br />

ASCII-like<br />

image<br />

Error; image<br />

not written<br />

Error; image<br />

not written<br />

P and Q<br />

Options<br />

Unchanged<br />

Fieldata image<br />

Unchanged<br />

ASCII image<br />

Unchanged<br />

ASCII-like<br />

image<br />

Unchanged<br />

image in<br />

"other" CCS<br />

Error; image<br />

not written<br />

In summary, when the P option is specified, the source output contains only Fieldata<br />

images; when the Q option is specified, the source output can contain images in ASCII<br />

and any of the 39 ASCII-like CCSs; and when both the P and the Q options are specified,<br />

the source output can contain images in any of the 63 legal CCSs.<br />

When neither the P nor the Q option is specified, the CCS of source output images<br />

depends on the presence of the I option.<br />

When the I option is specified, both the P and the Q option are assumed. Runstream<br />

images in all 63 legal CCSs can be written unchanged to the source output. The "P and<br />

Q options" column of the preceding table lists the SIR$ source output action for the<br />

runstream image types listed in the rows.<br />

When the I option is not specified, the CCS of the source output image is determined as<br />

follows:<br />

• When a source input image is written to the source output, it is written unchanged<br />

and retains its CCS.<br />

• When a runstream image following a -n line-change statement is written to the<br />

source output, the CCS of the output image is based on the CCS of source input<br />

image n, as shown in the table that follows.<br />

• When a runstream image following a -n,m line-change statement is written to the<br />

source output, the CCS of the output image is based on the CCS of source input<br />

image m, as shown in the table that follows.<br />

23–8 7833 1733–004


SIR$–Symbolic Input/Output Routine<br />

The columns of the table list the source input image type for image n or m, described<br />

above. The types are Fieldata, ASCII, or ASCII-like and other CCSs. The rows of the<br />

table list the runstream image type to be written to the source output. The types are<br />

Fieldata, ASCII, or ASCII-like and other legal CCSs. The intersection of the columns and<br />

rows is the SIR$ source output action with this combination of source input image CCS<br />

type and runstream image CCS type.<br />

Runstream<br />

Input Image<br />

Type<br />

Source Input<br />

Image is<br />

Fieldata<br />

Fieldata Unchanged<br />

Fieldata image<br />

ASCII or<br />

ASCII-like<br />

Translated to<br />

Fieldata image<br />

"Other CCS" Error; image not<br />

written<br />

Source Input<br />

Image is ASCII<br />

or ASCII-like<br />

Translated to<br />

ASCII_ISO<br />

image<br />

Unchanged<br />

ASCII,<br />

ASCII-like image<br />

Error; image not<br />

written<br />

Source Input<br />

Image is<br />

"Other" CCS<br />

Unchanged<br />

Fieldata image<br />

Unchanged<br />

ASCII,<br />

ASCII-like<br />

image<br />

Unchanged<br />

image in<br />

"other" CCS<br />

In summary, when the source input image is Fieldata the P option is assumed; when the<br />

source input image is ASCII or ASCII-like, the Q option is assumed; and when source<br />

input image is in another CCS, both the P and the Q options are assumed.<br />

Note that when the calling program is a multipass processor, the second and<br />

subsequent passes usually read the source output that is written by SIR$ during the first<br />

pass. This means that the CCS of an image processed during the first pass may be<br />

different when the same image is processed during the second and subsequent passes.<br />

For example, if the P option is specified, an ASCII-like source input image in decimal CCS<br />

41 is written to the source output in Fieldata. This means that on the second pass the<br />

image can no longer be identified as a CCS 41 image and, in fact, cannot be<br />

distinguished from images that were originally Fieldata, ASCII, or any of the 39 ASCII-like<br />

CCSs. A more extreme example is that if both the P and Q options are not either<br />

specified or assumed, source input images in the 22 “other” CCSs are not written to the<br />

source output. This means that on the second pass the images cannot be passed to the<br />

calling program since they were not written to the source output on the first pass.<br />

7833 1733–004 23–9


SIR$–Symbolic Input/Output Routine<br />

Character Set Change Control Record<br />

When the source output contains images in more than one CCS, Character Set Change<br />

control records are written by SIR$ each time an image to be written is in a different<br />

CCS than the previously written image. The Character Set Change control record<br />

indicates the CCS of one or more images that follow. The control record format is as<br />

follows:<br />

0 5 6 11 30 35<br />

042<br />

Word 0<br />

0 CCS<br />

S1<br />

S2<br />

S6<br />

042 indicates that this is a Character Set Change control record.<br />

Zero.<br />

The CCS of the data records that follow.<br />

23.2. SIR$ Entry Points<br />

The SIR$ routine contains six entry points<br />

OPNSR$ Initialize SIR$ for symbolic input and output.<br />

INISR$ Initialize SIR$ with additional information.<br />

GETAS$ Read a symbolic image in ASCII.<br />

GETSR$ Read a symbolic image in Fieldata.<br />

GETNM$ Read a symbolic image without translation.<br />

CLOSR$ Close SIR$ input and output.<br />

Note: Either OPNSR$ or INISR$ may be called for initialization. Both routines cannot<br />

be called on the same pass.<br />

23.2.1. OPNSR$–Open SIR$ Input and Output<br />

OPNSR$ initializes SIR$ to allow input and output of symbolic data.<br />

OPNSR$ provides first or second pass initialization for the GETAS$, GETSR$, and<br />

GETNM$ read symbolic image routines. If the symbolic input is from a program file or<br />

tape, the System Data Format Input (SDFI) routine is opened. If the symbolic output is<br />

specified, the System Data Format Output (SDFO) routine is opened.<br />

23–10 7833 1733–004


SIR$–Symbolic Input/Output Routine<br />

If input is from an element, the SDF type is tested. If S3 of the label control record is<br />

nonzero and not the Fieldata character "S", the message 'SI IS NOT SIR TYPE' is printed.<br />

All cycling information in the control words is then ignored.<br />

Calling Sequence<br />

LMJ X11,OPNSR$<br />

error return<br />

normal return<br />

Returns<br />

OPNSR$ takes the error return if:<br />

• SDFI is unable to open the symbolic input. Register A5 contains the I/O error status<br />

code from SDFI.<br />

• An attempt is made to process an invalid SDF file or element. Register A5 is set to<br />

zero. The associated error message is<br />

INVALID SDF LABEL WORD w<br />

where w is the first two words of the element or file printed in Fieldata.<br />

23.2.2. INISR$–Initialize SIR$ Input and Output<br />

INISR$ initializes SIR$ to allow input and output of symbolic data. INISR$ performs the<br />

first or second pass initialization functions described for OPNSR$ and additionally allows<br />

the calling program to control certain SIR$ actions.<br />

Calling Sequence<br />

L A4,initialization-word<br />

LMJ X11,INISR$<br />

error return<br />

normal return<br />

The initialization-word is provided by the caller to control certain SIR$ actions.<br />

The initialization-word can contain<br />

• A list of specific SDF control record types that SIR$ should not pass to the calling<br />

program.<br />

• A flag to indicate that SIR$ should not create source output if certain conditions are<br />

met.<br />

• A flag to indicate that when an ASCII-like image is passed to the calling program,<br />

SIR$ should include the CCS for the image.<br />

• A flag to indicate that SIR$ should pass images in all 63 legal CCSs to the calling<br />

program and should include the CCS for the image.<br />

7833 1733–004 23–11


SIR$–Symbolic Input/Output Routine<br />

Control Records to Pass<br />

On entry, bits 4 through 35 of A4 specify which SDF control records SIR$ should not<br />

pass to the calling program. If bit n is set, then the control record type 0103-n is not<br />

passed to the calling program. The control record is still written to the source output by<br />

SIR$.<br />

Example<br />

If A4 equals 013 on a call to INISR$, bits 32, 34, and 35 are set, or bits 040, 042, and 043<br />

in octal. This initializes SIR$ so that control record types 0103-040 = 043, 0103-042<br />

= 041, and 0103-043 = 040 are not passed to the calling program.<br />

Source Output Control<br />

If bit 0 of A4 is set, SIR$ checks for the following conditions:<br />

• The output is to a scratch file and not to a source output element (PARTBL+16=0).<br />

• The input is not from tape.<br />

• There are no changes to the symbolic input.<br />

If these conditions exist, SIR$ does not write to the processor's scratch file on the first<br />

pass. On subsequent passes, SIR$ rereads the input element. If these conditions are<br />

met, SIR$ performs approximately 75-percent fewer I/Os on the first pass than if SIR$<br />

were called with OPNSR$.<br />

Example<br />

@MASM,S non-tape-si-element,ro-element<br />

@EOF<br />

In this example, SIR$ does not send unused output to the processor scratch file when<br />

the Assembler sets register A4 to negative and calls INISR$ instead of OPNSR$.<br />

Return CCS Identifier<br />

Fieldata, ASCII, and ASCII-like symbolic images can be passed to the calling program in<br />

Fieldata by using the GETSR$ entry point, in ASCII by using the GETAS$ entry point, or<br />

without translation by using the GETNM$ entry point.<br />

If bit 1 of A4 is set, SIR$ stores the CCS identifier in S6 of A0 for all images passed to<br />

the calling program in ASCII (GETAS$ and GETNM$ entry points). This initialization<br />

option allows the caller to identify the actual CCS associated with each image passed in<br />

ASCII, which may be necessary for proper processing of images in different ASCII-like<br />

CCSs.<br />

If bit 1 of A4 is clear or if the OPNSR$ initialization entry point is called, SIR$ stores 01 in<br />

S6 of A0 for all images passed to the calling program in ASCII (GETAS$ and GETNM$<br />

entry points) and 00 in S6 of A0 for all images passed to the calling program in Fieldata<br />

(GETSR$ and GETNM$ entry points).<br />

23–12 7833 1733–004


SIR$–Symbolic Input/Output Routine<br />

Return Images in All CCSs<br />

Symbolic images in the 22 "other" CCSs cannot be translated by SIR$ into Fieldata or<br />

ASCII, so these images cannot be passed to the calling program using the GETSR$ or<br />

GETAS$ entry points.<br />

If bit 2 of A4 is set and the GETNM$ entry point is called to read a symbolic image, SIR$<br />

passes images in Fieldata, ASCII, ASCII-like CCSs, and the 22 "other" legal CCSs to the<br />

calling program without translation. SIR$ stores the CCS identifier of the image in S6 of<br />

A0.<br />

If bit 2 of A4 is clear or if the OPNSR$ initialization entry point is called, SIR$ does not<br />

pass images in the 22 “other” CCSs to the calling program, but instead returns an error.<br />

This ensures that only Fieldata, ASCII, and ASCII-like images are passed to a calling<br />

program, unless the program has explicitly set bit 2 in A4 to indicate that it can handle<br />

images in the 22 “other ” CCSs.<br />

23.2.3. GETAS$–Get Symbolic Image in ASCII<br />

The GETAS$ entry point is called to obtain the next input image from the source input or<br />

the runstream and to pass the image to the calling program in ASCII. Input images in<br />

Fieldata are translated to the ASCII_ISO CCS and passed to the calling program. Input<br />

images in ASCII and ASCII-like CCSs are passed without change to the calling program.<br />

An exception is that when the P option is either specified or assumed, requesting<br />

Fieldata source output, lowercase alphabetics are changed to uppercase alphabetics<br />

when the image is passed to the calling program. Input images in the 22 “other” CCSs<br />

are not passed to the calling program, but instead result in an error return.<br />

Calling Sequence<br />

L A0,(buffer-length,buffer-addr)<br />

LMJ X11,GETAS$<br />

error return<br />

end-of-file return<br />

normal return<br />

where:<br />

buffer-length<br />

The length in words of the buffer into which the symbolic input images are read.<br />

buffer-addr<br />

The address of the buffer into which symbolic input images are read.<br />

7833 1733–004 23–13


SIR$–Symbolic Input/Output Routine<br />

Returns<br />

A call to GETAS$ obtains the next symbolic image from the source input. The image is<br />

returned in the calling program buffer. The images are always returned in the ASCII<br />

character set. If the image was read in Fieldata, it is translated to ASCII before it is<br />

returned to the calling program.<br />

If the buffer is longer than the image read, the buffer is blank-filled to the end. If the<br />

buffer is shorter than the image read, only the part of the image that will fit in the buffer<br />

is returned; the rest of the image is lost. SIR$ reads up to a 63-word image and can be<br />

configured to read up to 2047 word images.<br />

If symbolic output is specified, SIR$ writes the image. Note that even though the image<br />

is passed to the calling program in ASCII, this does not affect the CCS of the image<br />

when it is written to the source output. As previously described, the P and Q options<br />

determine the CCS of the output image. For example, a Fieldata image is translated to<br />

ASCII_ISO when passed to the calling program, but the image would still be written to<br />

the source output in Fieldata if the P option or both the P and the Q options are<br />

specified.<br />

If SIR$ takes an error return because of an unrecoverable I/O error, A5 contains the I/O<br />

error status code. If SIR$ takes an error return because of a line-change statement error,<br />

partial line-change statement error, partial line-change editing statement error, source<br />

input image CCS error, or source output image CCS error, A5 is zero and A0 contains a<br />

print control word for a message describing the error. The calling program can do an<br />

ER PRINT$ to print the Fieldata error message.<br />

SIR$ takes the end-of-file return when there are no more symbolic input images to read.<br />

The following information is returned to the calling program in registers A0 through A5<br />

when the normal return is taken:<br />

A0<br />

A1<br />

(S6)<br />

If SIR$ was initialized with OPNSR$ or if SIR$ was initialized with INISR$ and A4<br />

bits 1 and 2 were both clear, the ASCII_ISO CCS identifier 01 is returned. If<br />

SIR$ was initialized with INISR$ and either A4 bit 1 or 2 was set, the CCS<br />

identifier of the image is returned. For a Fieldata image translated to ASCII, the<br />

ASCII_ISO CCS identifier 01 is returned.<br />

The SDF image control word for the record read. If bit 0 (leftmost bit) of register<br />

A1 = 1, the record returned to the caller is a control record, and registers A2 through<br />

A5 are undefined.<br />

23–14 7833 1733–004


A2<br />

A3<br />

A4<br />

A5<br />

(Q1)<br />

(Q2)<br />

(H2)<br />

SIR$–Symbolic Input/Output Routine<br />

ASCII "#" symbol (octal 043) if the sequence numbers in columns 73 through 80<br />

are not sequential. Otherwise, an ASCII space (octal 040). This applies only<br />

with the H and K options.<br />

ASCII "*" symbol (octal 052) if the image came from the runstream. Otherwise,<br />

an ASCII space (040).<br />

A 2-digit ASCII cycle number for the image.<br />

Contains one of the following in ASCII:<br />

• The characters "∆NEW" (if this is a new image).<br />

• The characters "xxxx" where xxxx is a left-justified, space-filled decimal number.<br />

It is preceded by a minus sign if 3 digits or less. This indicates the number of<br />

images deleted prior to this image.<br />

• Four space characters.<br />

The current line number of the symbolic input element. Register A4 = 0 for new<br />

images read from the runstream. The line number for each image is the same for all<br />

passes.<br />

An actual or generated CTS line number.<br />

7833 1733–004 23–15


SIR$–Symbolic Input/Output Routine<br />

23.2.4. GETSR$–Get Symbolic Image in Fieldata<br />

GETSR$ obtains a symbolic input image in Fieldata and returns it to the calling program.<br />

If symbolic output is specified, SIR$ writes the image to the output file or element.<br />

Calling Sequence<br />

L A0,(buffer-length,buffer-addr)<br />

LMJ X11,GETSR$<br />

error return<br />

end-of-file return<br />

normal return<br />

where:<br />

buffer-length<br />

The length in words of the buffer into which the symbolic input image is read.<br />

buffer-addr<br />

The address of the buffer into which the symbolic input image is read.<br />

Returns<br />

The GETSR$ entry point is called to obtain the next input image from the source input or<br />

the runstream and to pass the image to the calling program in Fieldata. Input images in<br />

ASCII and ASCII-like CCSs are translated to Fieldata and passed to the calling program.<br />

Input images in Fieldata are passed without change to the calling program. Input images<br />

in the 22 "other" CCSs are not passed to the calling program, but instead result in an<br />

error return.<br />

If the buffer is longer than the Fieldata image, the buffer is filled with Fieldata spaces to<br />

the end. If the buffer is shorter that the image, only buffer-length words are returned;<br />

the remainder of the image is lost. SIR$ reads images up to 63 words and can be<br />

configured to read images up to 2,047 words.<br />

If symbolic output is specified, SIR$ writes the image. Note that even though the image<br />

is passed to the calling program in Fieldata, this does not affect the CCS of the image<br />

when it is written to the source output. As previously described, the P and Q options<br />

determine the CCS of the output image. For example, an ASCII-like ISO_8859_5<br />

(decimal CCS 39) image is translated to Fieldata when passed to the calling program, but<br />

the image would still be written to the source output as an ISO_8859_5 image if the Q<br />

option or both the P and the Q options are specified.<br />

If SIR$ takes an error return, the information returned is the same as described for<br />

GETAS$ in 23.2.3.<br />

SIR$ takes the end-of-file return when there are no more symbolic images to read in<br />

either the source input or the runstream.<br />

The following information is returned to the calling program in registers A0 through A5<br />

when the normal return is taken:<br />

23–16 7833 1733–004


A0<br />

A1<br />

A2<br />

A3<br />

(S6)<br />

00, the Fieldata CCS identifier.<br />

SIR$–Symbolic Input/Output Routine<br />

The SDF image control word for the image read. If bit 0 of register A1 = 1, the<br />

record returned to the caller is a control record and registers A2 through A5 are<br />

undefined.<br />

(S1)<br />

(S2)<br />

(S3)<br />

(H2)<br />

Always contains a Fieldata space (octal 05).<br />

Fieldata "#" symbol (octal 03) if the sequence numbers in columns 73 through 80<br />

are not sequential; otherwise, a Fieldata space (octal 05). This applies only with<br />

the H and K options.<br />

Fieldata "*" symbol (octal 050) if the image came from the runstream; otherwise,<br />

a Fieldata space (octal 05).<br />

A 3-digit Fieldata cycle number for the image.<br />

Contains one of the following in Fieldata characters:<br />

• The 6 characters "∆∆∆NEW" if this is a new image.<br />

• A decimal number indicating the number of images deleted prior to this image.<br />

If the number is 5 digits or less, it is preceded by a minus sign (octal 041) and<br />

the digits are left-justified and space-filled on the right. If the number is 6 digits,<br />

it is not preceded by a minus sign.<br />

• Six space characters.<br />

7833 1733–004 23–17


SIR$–Symbolic Input/Output Routine<br />

A4<br />

A5<br />

The current line number of the symbolic input file or element. Register A4 is zero for<br />

new images read from the runstream. The line number for each image is the same<br />

for all passes.<br />

An actual or generated CTS line number.<br />

23.2.5. GETNM$–Get Symbolic Image Without Translation<br />

GETNM$ obtains a symbolic input image and returns it to the calling program with no<br />

translation. If symbolic output is specified, SIR$ writes the image to the output file or<br />

element.<br />

Calling Sequence<br />

L A0,(buffer-length,buffer-addr)<br />

LMJ X11,GETNM$<br />

error return<br />

end-of-file return<br />

normal return<br />

where:<br />

buffer-length<br />

The length in words of the buffer into which the symbolic input images are read.<br />

buffer-addr<br />

The address of the buffer into which the symbolic input images are read.<br />

Returns<br />

The GETNM$ entry point is called to obtain the next input image from the source input<br />

or the runstream and to pass the image to the calling program without translation. Input<br />

images in Fieldata, ASCII, and the 39 ASCII-like CCSs are passed without change to the<br />

calling program. An exception is that when the image to be returned is ASCII or<br />

ASCII-like and when the P option is either specified or assumed, requesting Fieldata<br />

source output, lowercase alphabetics are changed to uppercase alphabetics when the<br />

image is passed to the calling program. If SIR$ was initialized with INISR$ and A4 bit 2<br />

was set, input images in the 22 “other” CCSs are passed to the calling program. If SIR$<br />

was initialized with OPNSR$ or if SIR$ was initialized with INISR$ but A4 bit 2 was clear,<br />

input images in the 22 “other” CCSs are not passed to the calling program, but instead<br />

result in an error return.<br />

23–18 7833 1733–004


SIR$–Symbolic Input/Output Routine<br />

If the buffer is longer than the image, the buffer is filled to the end. If the image is<br />

Fieldata, the buffer is filled with Fieldata spaces, octal 05. If the image is ASCII or<br />

ASCII-like, the buffer is filled with ASCII spaces, octal 040. If the image is in an "other"<br />

CCS, the buffer is filled with binary zero characters, octal 0. If the buffer is shorter than<br />

the image, only “buffer-length” words are returned; the remainder of the image is lost.<br />

SIR$ reads images up to 63 words and can be configured to read images up to 2,047<br />

words.<br />

If symbolic output is specified, SIR$ writes the image. Note that even though the image<br />

is passed to the calling program without translation, this does not affect the CCS of the<br />

image when it is written to the source output. As previously described, the P and Q<br />

options determine the CCS of the output image.<br />

If SIR$ takes an error return, the information returned is the same as described for<br />

GETAS$ in 23.2.3.<br />

SIR$ takes the end-of-file return when there are no more symbolic images to read in<br />

either the source input or the runstream.<br />

When SIR$ takes a normal return, information is returned to the calling program in<br />

registers A0 through A5. If the passed image is Fieldata, the return information is as<br />

described in 23.2.4 for GETSR$. If the passed image is not Fieldata (ASCII, ASCII-like,<br />

or “other”), the return information is as described in 23.2.3 for GETAS$.<br />

23.2.6. CLOSR$–Close SIR$ Input and Output<br />

CLOSR$ closes the symbolic input file. If there is symbolic output, CLOSR$ closes the<br />

symbolic output file.<br />

CLOSR$ provides termination for the first and all subsequent passes. SIR$ closes the<br />

SDFI routine. If symbolic output was specified, SIR$ closes the SDFO routine. If the call<br />

to SIR$ is a first pass and the symbolic output is an element, an entry is made in the<br />

symbolic output program file through the Program File Package Insert routine (ER PFI$).<br />

Calling Sequence<br />

LMJ X11,CLOSR$<br />

error return<br />

normal return<br />

Error Return<br />

SIR$ takes the error return when SDFO is unable to close the symbolic output. Two<br />

other error returns are possible when source output is to be written to a program file<br />

element. SIR$ takes the error return when the text length is over 262,143 sectors or<br />

when ER PFI$ returns an error to SIR$.<br />

In the case of an SDFO error, register A5 contains the I/O error status code. In the two<br />

other cases, A5 is zero. In the case of the text length over 262,143 sectors, register A2<br />

contains the sector count, which is always at least octal 01000000. In the case of an<br />

ER PFI$ error, register A2 contains the PFI$ error status code, which is always less than<br />

octal 0100. (See the ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.)<br />

7833 1733–004 23–19


SIR$–Symbolic Input/Output Routine<br />

23.3. External Labels<br />

SIR$ contains a number of data areas that the calling program may access.<br />

• SIRIB$<br />

The start of the 1,792-word input buffer.<br />

• SIROB$<br />

The start of the 1,792-word output buffer.<br />

• SIRP2$<br />

Set to one in CLOSR$ to identify a second pass call to OPNSR$, INISR$,<br />

GETAS$, and GETNM$.<br />

• SIRSDFIFCT$<br />

The start of the SDFI file control table.<br />

• SIRSDFOFCT$<br />

The start of the SDFO file control table.<br />

The calling program may not use the SIRIB$ or SIROB$ buffers between calls to<br />

OPNSR$ or INISR$ and CLOSR$.<br />

23.4. SIR$–Multipass Capability<br />

SIR$ allows many passes to be made over the input element if a scratch file or output<br />

element is available in PARTBL+14,15. (For exceptions, see INISR$, 23.2.2.) For<br />

reusable processors, SIR$ must be told when to initialize itself to process the element<br />

designated on the next processor call statement that INFOR CLIST reads. The calling<br />

program must store zero into the externally defined cell SIRP2$ in SIR$. No other action<br />

is required.<br />

23.5. Compressed Symbolic Elements<br />

To minimize the number of cards required to contain a symbolic element, the FURPUR<br />

processor can compress strings of blanks in symbolic images before punching the<br />

element. SIR$ expands the compressed images on input.<br />

A compressed symbolic image card deck is produced when the appropriate options are<br />

used on the FURPUR @PCH control statement. (See the ECL and FURPUR <strong>Reference</strong><br />

<strong>Manual</strong>.) SIR$ converts compressed card image decks to SDF images upon initial input<br />

when the I and G or J options are specified on the processor call statement (see G.1).<br />

The first card punched is an @ELT or @PDP control statement with the appropriate<br />

options. Following the control statement are the cards that contain compressed<br />

symbolic images.<br />

The compressed image consists of a stream of characters in the following format:<br />

23–20 7833 1733–004


xccc...cyxccc...cz<br />

where:<br />

x Number of characters C (1 ≤x ≤ 37)<br />

y 40 + Number of blanks (41 < y ≤ 77)<br />

z 40 = End of image<br />

SIR$–Symbolic Input/Output Routine<br />

The number of characters in a string is limited to 37; the number of blanks is limited to<br />

36. If either is larger, a new x or y is initiated.<br />

In addition to the x, y, and z characters, two other special characters are used:<br />

41 character<br />

indicates the end of images in this element.<br />

0 character<br />

is a special character in column 80 if a new x will begin in column 80. The x is<br />

moved to the next physical card and the 0 is placed in column 80.<br />

The compressed images immediately follow one another on the physical card and<br />

continue to the next card when the end of card is reached. The punch routine begins<br />

each physical card with an x, y, or z by breaking an x string at the end of the card and<br />

starting a new string on the next card. This guarantees a nonzero character in the first<br />

character position of the card. A compressed blank image is represented by a 40<br />

character. The physical card may contain compressed image characters in columns 1<br />

through 80.<br />

Compressed images are not retained in the program file. SIR$ expands the images and<br />

stores them in the program file in SDF format.<br />

Compressed image symbolic input is an SIR$ configurable feature.<br />

7833 1733–004 23–21


SIR$–Symbolic Input/Output Routine<br />

23–22 7833 1733–004


Section 24<br />

Program Trace Routine<br />

The Program Trace Routine (SNOOPY) is a routine that traces through programs. It is<br />

used with assembly language programs. In batch mode, SNOOPY provides information<br />

about every instruction executed and the effect it had. In demand mode, SNOOPY is a<br />

powerful diagnostic routine that gives the caller control over the trace operation. The<br />

following paragraphs describe how to use SNOOPY in batch mode. Large printouts may<br />

be produced.<br />

A program that is being traced functions the same as a program that is not being traced<br />

except that:<br />

• Execution time is slower. This can affect I/O timing, which might be relevant to the<br />

program being diagnosed.<br />

• Contingencies that would normally error terminate the activity being traced<br />

terminate EXIT$.<br />

The following restrictions apply to SNOOPY:<br />

• SNOOPY must be part of the program's main segment (see the Collector<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>).<br />

• Tracing terminates if the main segment is reloaded.<br />

• Only one activity may be traced at a time unless the caller uses duplicate copies of<br />

SNOOPY.<br />

• The program cannot be traced if it is running in real-time mode.<br />

• No activity contingency routine may exist for the activity being traced.<br />

• The only I/O Executive requests permitted are IO$ and IOW$.<br />

• Byte instructions and J-register (character addressing) mode for the 1100/60,<br />

1100/70, and 1100/80 are not traced. The EIS instructions for the 1100/60 and<br />

1100/70 are not simulated.<br />

• The major register set must be available.<br />

7833 1733–004 24–1


Program Trace Routine<br />

• The following Executive requests (ERs) are supported with packet dumps and<br />

register displays:<br />

ABORT$ DATE$ PFS$<br />

ACSF$ EDJS$ PFUWL$<br />

APCHCA$ ERR$ PFWL$<br />

APCHCN$ EXIT$ NCHA$<br />

APNCHA$ FACIL$ PRINT$<br />

APRINT$ FACIT$ PRNTA$<br />

APRNTA$ FITEM$ PRTCA$<br />

APRTCA$ FORK$ PRTCN$<br />

APRTCN$ IALL$ PSR$<br />

APUNCH$ IO$ PUNCH$<br />

AREAD$ IOW$ READ$<br />

AREADA$ LCORE$ READA$<br />

ATREAD$ LOAD$ SETC$<br />

BANK$ MCORE$ SNAP$<br />

BDI$ MCT$ SWAIT$<br />

CEND$ MSCON$ SYMB$<br />

COM$ OPT$ TDATE$<br />

COND$ PCHCA$ TFORK$<br />

CRTN$ PCHCN$ TIME$<br />

CSF$ PCT$ TREAD$<br />

CTS$ PFD$ TWAIT$<br />

CTSA$ PFI$ WAIT$<br />

CTSQ$<br />

Other ERs pass parameters using the A0 and A1 registers only, but they do not<br />

provide full packet display.<br />

• SNOOPY recognizes the following OS 2200 instruction mnemonics:<br />

AAIJ, AH, AMA, ANA, AND, ANH, ANMA, ANT, ANU, ANX, AT, AU, AX, BT, CDU,<br />

DA, DAN, DDC, DEC, DEC2, DF, DFA, DFAN, DFD, DFM, DFP, DFU, DI, DJZ, DL,<br />

DLM, DLN, DLSC, DS, DSA, DSC, DSF, DSL, DTE, EDC, ENZ, ER, EX, FA, FAN, FCL,<br />

FD, FEL, FM, HJ, INC, INC2, J, JB, JC, JDF, JFO, JFU, JGD, JK, JMGI, JN, JNB,<br />

JNC, JNDF, JNFO, JNFU, JNO, JNS, JNZ, JO, JP, JPS, JZ, LA, LBJ, LCF, LDJ,<br />

LDSC, LDSL, LIJ, LMA, LMJ, LNA, LNMA, LPD, LR, LSC, LSSC, LSSL, LUF, LX, LXI,<br />

LXM, MASG, MASL, MCDU, MF, MI, MLU, MSE, MSG, MSI, MSLE, MSNE,<br />

MSNW, MSW, NOP, OR, PAIJ, SA, SAS, SAZ, SE, SFS, SFZ, SG, SIL, SLE, SLJ,<br />

SMA, SNA, SNE, SNW, SNZ, SN1, SPD, SP1, SR, SSA, SSC, SSL, SW, SX, SZ, TCS,<br />

TE, TEP, TG, TLE, TLEM, TN, TNE, TNW, TNZ, TOP, TP, TS, TSS, TW, TZ, XOR.<br />

24–2 7833 1733–004


24.1. Calling Sequence<br />

There are two formats available for calling SNOOPY.<br />

Format 1<br />

SLJ SNOOPY$<br />

+ mode-bits,termination-addr . mode-word<br />

where:<br />

mode-bits (bits 0 through 17 where bit 0 is the leftmost bit)<br />

Program Trace Routine<br />

Bit 17 controls quarter-word mode sensitivity. If bit 17 of the mode word is set,<br />

SNOOPY simulates quarter-word mode for checkout of quarter-word sensitive<br />

programs on machines without quarter-word hardware. If bit 17 is clear,<br />

SNOOPY uses either third- or quarter-word mode, depending on the mode set in<br />

the Processor State Register (PSR) on entry. If bit 18 is set, the mode word<br />

suppresses the solicitation of commands at the beginning and end of a trace<br />

when using SNOOPY in demand mode.<br />

termination-addr (bits 18 through 35)<br />

Format 2<br />

Tracing begins with the instruction following the mode word. Tracing continues<br />

until the termination address (termination-addr) is reached or until another<br />

termination condition is encountered.<br />

SLJ TON$<br />

Tracing begins following the SLJ instruction and continues until it encounters a<br />

termination condition. The quarter-word mode sensitivity is unchanged with this<br />

format.<br />

24.2. Terminating Trace<br />

Tracing is terminated in batch mode by any of the following:<br />

• Reaching the specified termination address. Program execution continues.<br />

• Using the SLJ TOFF$ instruction (program execution continues). If an SLJ TOFF$<br />

instruction is executed outside of the trace routine, it has no effect.<br />

• Using the ER EXIT$ instruction (see the Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>).<br />

This not only terminates SNOOPY, but it also terminates the activity being traced.<br />

• Encountering a program contingency of types 1, 2, 7, or 12 for which standard<br />

system action has been specified. The activity being traced is terminated by EXIT$.<br />

7833 1733–004 24–3


Program Trace Routine<br />

Tracing can be terminated in batch or demand mode with the following methods:<br />

• Use the TOFF$ command (see 24.4.2). Program execution continues.<br />

• Use the EXIT$ command (see 24.4.2)<br />

24.3. Symbol Tables<br />

When using SNOOPY, the u-field of the instruction is edited in octal if it does not refer to<br />

control storage.<br />

The calling program can provide a symbol table to SNOOPY using Fieldata characters<br />

instead of octal values when the u-field falls within the address range of the program<br />

being traced. To do this, store a value in the externally defined location SYMTB$.<br />

SNOOPY uses the symbol table while tracing a program. The value stored in SYMTB$<br />

has the following form:<br />

0 17 18 35<br />

nbr-of-entries table-addr<br />

H1 H2<br />

The symbol table at the specified address is an array of three-word entries in the form:<br />

0 high +1 low<br />

1 Fieldata symbol name or address of long name<br />

2 bits symbol address<br />

H1 H2<br />

If the rightmost bit of bits (bit 17) is set, SNOOPY assumes word 1 of the entry is the<br />

address of a 7- to 12-character Fieldata symbol instead of a 1- to 6-character Fieldata<br />

symbol. This accommodates long labels.<br />

The next word after the last entry may be another symbolic table descriptor word. This<br />

occurs if bit 1 is set in the last entry of the symbol table. SNOOPY searches the symbol<br />

table to which it points in the same fashion. This may be repeated to any level desired.<br />

However, circularity must be avoided (in other words, pointing to the address of a<br />

higher-level symbol table).<br />

If the u-field of an instruction is between the low- and high-address values, edit the<br />

u-field as the symbol given by the second word of the entry, plus or minus an offset<br />

calculated from the symbol address in the third word. If the nbr-of-entries parameter of<br />

SYMTB$ is zero as it is initially, all u-fields outside control storage are edited in octal<br />

except TOFF$ and a number of ER indexes.<br />

24–4 7833 1733–004


24.4. Demand Mode Operation<br />

Program Trace Routine<br />

The caller has a great deal of control over the behavior of SNOOPY in demand mode.<br />

SNOOPY examines the program control table (PCT) to compute storage limits and the<br />

contingency routine address.<br />

When SNOOPY traces a demand program, the amount of output that SNOOPY produces<br />

is reduced (relative to batch mode) because of the low-speed output devices. In<br />

particular, header and trailer messages are brief, registers are dumped only on request,<br />

and line length may be restricted. Further control over printing may be obtained by using<br />

commands described in 24.4.2.<br />

For demand programs, SNOOPY operates in two modes.<br />

• Trace mode, in which instructions are traced<br />

• Command mode, in which the caller uses commands that direct SNOOPY's<br />

operation<br />

SNOOPY enters command mode under these circumstances.<br />

• On entrance, before tracing any instructions, unless mode bit 16 was set<br />

• When the Remote Break (RBK) contingency occurs (@@X C)<br />

• On completing the number of instructions specified by a SKIP or a numeric<br />

command<br />

• When encountering a condition specified by the BREAK or TRAP command<br />

• When an instruction is executed at an address specified on a CAPTUR command<br />

• At trace termination, unless mode bit 16 was set<br />

In command mode, the prompt is “C--”. SNOOPY solicits required parameter fields by<br />

indicating the nature of the required parameter. More than one command can be<br />

entered on any line solicited in command mode (including parameter lines).<br />

Delimiters separate the commands and parameters. A delimiter is any character not in<br />

the set (A through Z, 0 through 9, $, or -). Excess blanks are ignored. If any other<br />

consecutive delimiters are encountered, the effect is the same as the STEP command.<br />

That is, if answering “C--” with a line consisting of “////”, it has the same effect as four<br />

STEP commands.<br />

In certain cases, specific delimiters are required. To omit a parameter entirely, follow the<br />

delimiter that terminated the command by another (nonblank) delimiter (for example,<br />

“PRINT/”). Trace mode is suspended, the last instruction is printed, and a soliciting<br />

message appears under the above six circumstances.<br />

7833 1733–004 24–5


Program Trace Routine<br />

In each of the following circumstances, SNOOPY ignores all commands on the line after<br />

the last one performed; they can be reentered if desired.<br />

• Trace termination (unless mode bit 16 was set).<br />

• The @@X C sequence interrupts the trace.<br />

• SNOOPY encounters an invalid command.<br />

• A CHANGE, TOFF$, or EXIT$ command is used without a trailing asterisk.<br />

Entering a blank line (carriage return) in reply to the “C--” has the same effect as the<br />

STEP command. A blank line response to a parameter request may be erroneous or may<br />

have a special meaning, depending on the nature of the command.<br />

To enter an Executive control statement, answer a command solicitation by entering a<br />

line beginning with the character %. The remainder of the line should be an Executive<br />

control statement without the initial @ character. The statement must be legal for<br />

submission to the CSF$ Executive Request function. SNOOPY converts the initial %<br />

character to an @ and submits the resulting image to CSF$.<br />

If the CSF request is processed normally, the status bits from register A0 are displayed<br />

and SNOOPY solicits the next command. Otherwise, SNOOPY intercepts the<br />

appropriate contingency and prints the message “CSF$ ERROR” followed by command<br />

solicitation. For example, to assign a temporary file named T35, respond to “C--” by<br />

typing “%ASG,T T35,F2”.<br />

When command mode is entered at trace termination, the trace may be completed only<br />

by using the GO or STEP commands or a command with an equivalent effect. Once<br />

such a command is entered, no further commands are executed, and the trace<br />

terminates. The activity then continues execution or exits, depending on the type of<br />

trace termination.<br />

In all cases where number is called for, octal notation is assumed. Unless indicated<br />

otherwise, a leading zero is not required. In general, SNOOPY uses octal notation<br />

everywhere except in register designations and in the instruction cycle count printed by<br />

SNOOPY.<br />

Certain commands (TOFF$, EXIT$, and CHANGE) clear SNOOPY's command buffer<br />

before reading further commands because of the potentially irreversible nature of the<br />

operation that will be performed. If this is not desired, affix an asterisk to the command<br />

(TOFF*). For example, to terminate a trace and continue an execution without typing in<br />

two lines, use the sequence “TOFF$*GO”.<br />

Refer to 24.4.2 for a list of all SNOOPY commands. All commands except ALTPRT,<br />

TON$, RBK, RLIB, and STEP can be abbreviated to the first character.<br />

In some cases, particularly for complex programs, the set of commands SNOOPY<br />

provides may not meet all debugging requirements. For this reason, there is a method<br />

that allows the command interpreter to be extended as needed.<br />

24–6 7833 1733–004


Program Trace Routine<br />

SNOOPY links to a user-supplied subroutine when it encounters a command that is not<br />

contained in the set of standard commands. (Because one-character abbreviations are<br />

permitted for most SNOOPY commands, the command cannot begin with the same<br />

letter as a SNOOPY command. Therefore, the commands should begin with a $<br />

character.)<br />

A user command routine is identified to SNOOPY by storing its address in H2 of the<br />

externally defined cell SNUCM$. If SNOOPY cannot recognize the command, the user<br />

routine must return to 0,X11; normal return is to 1,X11. The volatile register set can be<br />

used without saving and restoring it.<br />

When SNOOPY enters the user command routine, registers A1 and A2 contain the<br />

command in Fieldata, the command is left-justified and space-filled, register X2 contains<br />

the current program address (simulated P register), and X10 points to an area containing<br />

the program's simulated control registers. These registers are located offset to a<br />

location that corresponds to their absolute addresses; for example, A0 contents at<br />

014,X10, R5 contents at 0105,X10, and so on. The program can change the value in<br />

SNUCM$ at any time, even while SNOOPY is performing a trace. If it is set to zero,<br />

SNOOPY does not interpret any user commands.<br />

The command routine may reference SNOOPY's command reading routine and lexical<br />

scanner by performing an SLJ to SNGTC$. A0 should contain zero or a pointer to a<br />

TREAD$ packet before it calls SNGTC$.<br />

If register A0 = 0, SNOOPY will not read the input; the remainder of the line containing<br />

the user command will be scanned for information. If A0 contains a TREAD$ packet<br />

pointer, the calling program must specify the input buffer SNBUF$. On return from<br />

SNGTC$, register A0 is unchanged; A1 and A2 contain a Fieldata command which is<br />

left-justified and space-filled (unless A3 = 0); A3 contains the nonblank character count<br />

for A1 and A2; and register R1 has the terminated delimiter. If an entirely blank line is<br />

encountered, registers A3 = 0 and R1 = '/'.<br />

SNOOPY commands conform to element name syntax (alphabetics, numerics, “-”,<br />

and “$”).<br />

24.4.1. Contingency Processing<br />

In some cases, because of time constraints, it is undesirable to use SNOOPY to trace an<br />

entire program. Instead, SNOOPY can gain control only when a contingency occurs.<br />

To call a routine that does this, enter the following:<br />

SLJ SNCNT$<br />

After this calling sequence is read, the program proceeds normally until a contingency is<br />

encountered. When a contingency occurs, SNOOPY takes control and the simulated<br />

P register points to the contingency address + 1. A message indicating the nature of the<br />

error is printed. If the contingency is fatal and the program is in batch mode, SNOOPY<br />

exits (EXIT$). For nonfatal contingencies, the remainder of the program is executed.<br />

7833 1733–004 24–7


Program Trace Routine<br />

In demand mode, the caller has control and can examine the program environment. No<br />

distinction is made between fatal and nonfatal contingencies in demand mode. Note<br />

that it is the caller's responsibility to clear registers in case of arithmetic fault and to<br />

respond to the onsite operator in case of a II keyin. For interrupt guard mode (IGDM),<br />

the trapped address may or may not be the address of the offending instruction.<br />

Contingency interception can be reset with the following:<br />

SLJ SNCLR$<br />

In frequently executed code, the caller may not want to trace every iteration of a loop or<br />

every call of a subroutine. A bug may not appear until a routine executes a number of<br />

times. The following calling sequence provides a way to call SNOOPY selectively.<br />

SLJ TCNT$<br />

+ count,start<br />

+ until,every<br />

+ mode-bits,termination-address<br />

where mode-bits and termination-address are the same as for an SLJ to SNOOPY.<br />

The count field should be zero initially; it is incremented on each pass through the code.<br />

If start ≤ count < until and (count - start)///every = 0 or (count - start) modulo every = 0,<br />

SNOOPY begins tracing following the mode word. Otherwise, execution will continue in<br />

normal (untraced) mode.<br />

24.4.2. Demand Mode Commands<br />

These are the SNOOPY commands, their permissible abbreviations, and their functions.<br />

ABSAD (ABS, A)<br />

Converts relative program addresses to absolute addresses. The parameters are<br />

eltname,loc-counter,location.<br />

or<br />

symbol*<br />

If the program is segmented and the specified address is in a segment not in main<br />

storage, a message is printed.<br />

In case of symbols, the Collector may look up only referenced symbols defined by<br />

non-SYS$*RLIB$ routines unless the collection source code includes a<br />

“TYPE EXTDIAG” statement. In this case, the Collector may search for all symbols<br />

(see the Collector <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>).<br />

This command is useful in conjunction with the BREAK, CAPTUR, CHANGE, DUMP,<br />

JUMP, and TRAP commands.<br />

24–8 7833 1733–004


ALTPRT (PRT)<br />

Program Trace Routine<br />

Sends all trace printout to an alternate print file while command solicitation,<br />

command responses (as for DUMP, for example), and all program print requests are<br />

sent to the terminal as usual. One parameter may be entered that is the name of<br />

the file to be used as an alternate print file. If the file specified is not assigned,<br />

SNOOPY automatically assigns a temporary file. (If the file will be printed by the<br />

@SYM statement, it must be assigned as cataloged rather than temporary.) If the<br />

program traced uses alternate symbiont files, the restrictions on the maximum<br />

number of alternate files that are allowed open must be followed.<br />

The ALTPRT command gives control of the alternate print files. In general, the<br />

ALTPRT command uses an alternate file and the current alternate file is breakpointed<br />

(@BRKPT). This action may be suppressed by using an asterisk (*) as the trailing<br />

delimiter for the parameter (for example, either “ALTPRTfilename*” or<br />

“ALTPRT *”).<br />

To obtain printouts both at a terminal and in an alternate file, the ALTPRT filename<br />

should have a trailing exclamation point (!), (for example, “ALTPRTfilename!”). This<br />

is useful for obtaining a permanent record when working at a terminal that lacks a<br />

hard-copy capability. If an alternate file is already active, the command forms<br />

“ALTPRT !” and “ALTPRT ?” may be used to set and clear echo mode while leaving<br />

the same alternate file in use. Echo mode is always cleared when the trailing<br />

exclamation point is not used. Therefore, to start a new alternate file without<br />

breakpointing the old file and with echo mode set, use the command sequence<br />

“ALTPRT* ALTPRTfilename!”.<br />

If the parameter is omitted (as in “ALTPRT/”), printing is directed to the terminal as it<br />

is initially. This command is effective for all SNOOPY operations until another<br />

ALTPRT command is given or the program being traced terminates. This command<br />

forces the location counter element name printout to be given so that each piece of<br />

printout may be easily identified.<br />

BREAK<br />

The BREAK loc-1, loc-2,... command indicates a stopping point for SNOOPY when<br />

operating in trace mode. When any specified address is reached, the trace stops<br />

and SNOOPY enters command mode. This command is useful for running with<br />

printing turned off. Use the form BREAK+ to add entries to the existing table. A<br />

maximum of 16 addresses is permitted. Use the $ specification to retrieve the last<br />

address returned by the ABSAD command. The form BREAK? lists the table of<br />

break addresses. The command BREAK may be abbreviated to just the letter B.<br />

This form of the BREAK command is incompatible with the previous form. The<br />

change is made for reasons of efficiency and utility; the break on element name or<br />

location counter was seldom used but introduced considerable overhead for each<br />

instruction traced, while it was impossible to have more than one break active at the<br />

same time. Determine which form of the BREAK command is available in SNOOPY<br />

by entering the BREAK command without parameters on the same line (or a “/” to<br />

indicate no parameters). The old form of BREAK solicits input with “ELT NAME--”,<br />

whereas the new form requests input with “LOCN--”.<br />

7833 1733–004 24–9


Program Trace Routine<br />

CAPTUR<br />

Enters SNOOPY from ordinary program execution mode whenever control reaches<br />

any of a specified set of addresses. The instructions at the specified addresses are<br />

overlaid by a jump to a SNOOPY internal table area, where an SLJ TON$ is<br />

performed, followed by the overlaid instruction. The overlaid instruction may not be<br />

referenced as data by the program, but there are no other restrictions. The syntax of<br />

the command is CAPTUR loc-1,loc-2,..… Up to eight locations may be specified,<br />

separated by commas. Any existing list is replaced by the new list (with the overlaid<br />

instructions restored). If CAPTUR+ is used, the specifications are added to the<br />

existing table, again up to a total limit of eight. Use CAPTUR? to print out the<br />

contents of the table.<br />

When using this command with segmented or multibanked programs, take care that<br />

the specified capture locations are in main storage when they are changed. The<br />

locations must not reside in a read-only bank. The purpose of this command is to<br />

provide the fastest possible means of getting past a portion of the program that is<br />

irrelevant to the debugging task. The use of external symbols is subject to the<br />

restrictions noted for the ABSAD command. See CHANGE command for use of the<br />

symbol $.<br />

CHANGE (C)<br />

Allows the caller to change the contents of control registers or main storage. The<br />

single parameter specifies the location to be changed. After reading the location<br />

parameter, the contents of the specified location are displayed as if the location<br />

parameter had been given to a DUMP command; then the new value is solicited.<br />

The new value is stored and the new contents displayed. A void new value does not<br />

change the indicated main storage element.<br />

If the parameter is a register name, a number, or a number or register name<br />

preceded by an H or Q, the new value is to be entered as a single octal number.<br />

The CHANGE command allows the caller to use mnemonics and external symbols<br />

for I format (instruction format) changes, as well as octal values. The first item given<br />

to “NEW VAL--” may be an op-code mnemonic instead of an octal number for the<br />

f-field of the instruction. Abbreviated forms such as L, LN, ANM, etc. are not<br />

permitted; however, LX, LA, LR, LNA, ANMA, and so on must be used.<br />

For some instructions, the op-code mnemonic specifies values for the j-field and<br />

perhaps the a-field as well. In such cases, the next value given to the CHANGE<br />

command is an a-field or an x-field. Mnemonics may also be used for the<br />

j-designator values (W, H1, H2, XH1, XH2, T1, T2, T3, S1, S2, S3, S4, S5, S6, Q1, Q2,<br />

Q3, Q4,U, and XU) and for standard X, A, and R register names. If a register name is<br />

used in the a-field of an instruction, its value will be adjusted appropriately.<br />

Truncation errors are not detected.<br />

24–10 7833 1733–004


Program Trace Routine<br />

Fields of an instruction are always expected to be entered in the order f, j, a, x, h, i,<br />

and u. Note that the h- and i-fields are combined. An external symbol may be used<br />

for any field except the f-field, subject to the same restrictions noted for the ABSAD<br />

command.<br />

For specification of an address to the CHANGE command, $ and $P have the following<br />

special meanings:<br />

$P<br />

$P-n$<br />

P+n<br />

$<br />

$-n$<br />

+n<br />

CLEAR<br />

The P register of the traced program.<br />

Where n is an octal number used to compute a value offset negatively or<br />

positively from $P.<br />

The last value returned by the ABSAD command, or the last address plus one<br />

changed (CHANGE) or dumped (DUMP). This allows the caller to continue a<br />

dump or change operation immediately following the last area referenced, or to<br />

change a cell at an address to be calculated by ABSAD without retyping the<br />

absolute address.<br />

Where n is an octal number, used to compute a value offset negatively or<br />

positively from $.<br />

The form $P (but not $P-n, $, or $-n) may also be used with the RELAD command.<br />

Clears one or more flags. List the flags to be cleared as names separated by<br />

commas. See the STATUS command for flag names and meanings.<br />

DUMP (D)<br />

Displays the program status. Separate each parameter by a comma. If no<br />

parameter or an empty parameter (that is, two consecutive commas) is entered, all<br />

registers and the carry and overflow designators are dumped. The parameters are:<br />

A,X, or R<br />

Dumps the indicated group of registers. To dump the contents of a single<br />

register, use the register mnemonic or the octal address.<br />

7833 1733–004 24–11


Program Trace Routine<br />

T<br />

L<br />

B<br />

S<br />

E<br />

N<br />

Dumps the carry and overflow designators.<br />

Displays current storage limits.<br />

Displays names of active banks (in order main-I, main-D, utility-D, with commas<br />

indicating place for unbased BDR portions) indicate write-inhibited banks by an<br />

asterisk (*). Banks whose names cannot be found in diagnostic tables are<br />

printed in octal numbers.<br />

Displays names of active segments.<br />

Last contingency and address, if any.<br />

Instruction cycle count.<br />

Any dump specification that references an address may be given a trailing + sign<br />

followed by an octal number n. A dump is then taken of n consecutive storage locations<br />

following the original address in the same format as the first dump, resulting in a dump<br />

of n+1 locations. The number of items printed per line depends on the line length set by<br />

the LINE command.<br />

If a specification number is neither the address of a register nor within the storage limits<br />

of the program, an error message is displayed.<br />

See CHANGE command for use of symbols $ and $P.<br />

The contents of the specified location or locations are printed in octal unless a format<br />

letter is given. The format letters are as follows:<br />

• The letter I preceding a number or register designator produces an instruction format<br />

dump.<br />

• The letter H preceding a number or register designator produces a Fieldata character<br />

dump.<br />

• The letter Q preceding a number or register designator produces an ASCII character<br />

dump.<br />

24–12 7833 1733–004


EXIT$ (E)<br />

GO (G)<br />

HDG<br />

JHT<br />

Program Trace Routine<br />

Terminates the traced activity by means of an EXIT$ request. Trace mode is<br />

terminated and the last instruction is printed.<br />

Returns to trace mode from command mode.<br />

This command allows the caller to insert print control information into SNOOPY's<br />

output, whether directed to a standard symbiont file or to an alternate file. Unless<br />

given as “HDG*”, the command buffer is flushed, and all other commands on the<br />

line are ignored. In any case, the input for this command is solicited by the printout<br />

“HDG- -”. Only print control information may go on this line; no commands are<br />

permitted. The format is identical to that used for the PRTCN$/PRTCA$ ERs.<br />

In particular, for heading information, the format is “H,opt,ps,txt”. But any of the<br />

other print control functions may be used.<br />

Prints the jump history table, starting with the most recent jump-from address and<br />

continuing with the last eight jump instructions that transfer control. The table is<br />

cleared on entry to SNOOPY, so fewer than eight addresses may be printed early in<br />

a trace. A jump that has been executed several times in succession without any<br />

other jumps intervening (that is, a loop) produces a listing with a repeat count, rather<br />

than many identical entries in the table. On 1100/60, 1100/70, and 1100/80<br />

systems, if SNOOPY is activated by a contingency after a call on SNCNT$, the JHT<br />

command can be used to retrieve the hardware jump history stack as captured at<br />

the time of the contingency. This applies only to hardware contingencies (IOPR,<br />

IGDM, IFOF, IFUF, and IDOF).<br />

JUMP (J)<br />

Transfers control to an address specified as an octal number or externally defined<br />

symbol. The current absolute and relative P-register values are displayed. If the new<br />

value is within the program storage limits, that value is set into the P register. The<br />

new value is printed in relative form, and the next command is executed.<br />

This command is the only way to get out of EXIT$ mode and do further tracing by<br />

means of the TON$ command. If TON$ is used in the EXIT$ mode without a JUMP<br />

command, the TON$ command is rejected and a message is displayed.<br />

If a JUMP command is used in EXIT$ mode termination, the termination mode<br />

becomes a TOFF$ termination. Use a TON$ command to continue tracing.<br />

The jump-to address specified for the JUMP command may be an external symbol<br />

as well as an octal value, subject to the restrictions on use of external symbols noted<br />

for the ABSAD command.<br />

7833 1733–004 24–13


Program Trace Routine<br />

LINE<br />

Adjusts the length of the line printed by SNOOPY. If "LINE /" is entered, the line<br />

length set is the default value of 132 decimal = 204 octal. Otherwise, the parameter<br />

given to LINE must be an octal number denoting the line length for the device in<br />

use. As indicated, the default value is 132 decimal = 204 octal for devices such as<br />

DCT 500 terminals.<br />

For a UNISCOPE or UTS Display terminal, use “LINE 116” with alternate print files<br />

(see the ALTPRT command), “LINE 204” may be the most convenient. The effect<br />

of a LINE command is canceled by the next LINE command or by program<br />

termination. The previous value will be printed as “WAS nnn”. This value is also<br />

printed when SNOOPY signs on unless NO HDG is set.<br />

number<br />

Has the same effect as a SKIP n GO sequence (where n is the number). See SKIP<br />

command. The number is in octal.<br />

PRINT (P)<br />

Allows the amount of printing to be modified. The PRINT command recognizes only<br />

one parameter at a time. If an invalid parameter or no parameter is specified, the<br />

F parameter is assumed. The parameters are:<br />

C<br />

E<br />

F<br />

N<br />

P<br />

Produces a printout omitting extraneous formatting spaces.<br />

Produces an expanded printout including formatting spaces. The E mode is<br />

effective until a PRINT C is encountered.<br />

Produces a full printout consisting of each instruction, its location, and the<br />

contents of main storage and registers (in before/after form if the value<br />

changed). For certain Executive Requests, the contents of the associated<br />

packet are also dumped. This is the default mode.<br />

Suppresses printout. This provides a means of skipping long sections of<br />

irrelevant code.<br />

Produces a printout of the instructions but not referenced main storage or<br />

Executive Request packets. If SNOOPY is in the N mode, the P mode is entered<br />

automatically upon the occurrence of an RBK contingency or encountering a<br />

BREAK-specified break condition.<br />

24–14 7833 1733–004


RBK<br />

I,n<br />

M,msk<br />

Program Trace Routine<br />

The value of n is an exponent of 2, indicating the frequency with which the<br />

instruction cycle printout is given. The default is 10, the minimum is 6. Turn off<br />

the printout using a value of 35.<br />

The value of msk is a mask that determines which instructions are to be edited<br />

while tracing. The most useful value for msk is 400, which suppresses all<br />

instructions except for jumps, skips, and Executive Requests. Other values for<br />

msk are determined by examining the code for SNOOPY (edit descriptor bits).<br />

Allows the caller to simulate an RBK contingency for the executing program; the<br />

actual RBK contingency is intercepted by SNOOPY and directs a return to command<br />

mode. This command allows a contingency routine to be traced. If the program<br />

does not expect the contingency, an appropriate message is displayed.<br />

RELAD (R)<br />

Converts absolute program addresses to relative addresses. A list of locations<br />

separated by commas may be specified as parameters.<br />

See $P specification for DUMP command.<br />

Ambiguities are resolved in favor of elements residing in loaded segments in active<br />

banks; otherwise a location may be specified as addr/bdi.<br />

RLIB param<br />

param may be an A, E, L, N, or X. Anything else is assumed to be N. The<br />

parameters are:<br />

A<br />

Allows tracing of RLIB$ routines, which include elements from the SYS$*RLIB$<br />

and SYS$*DATA$.LIB$NAMES files and elements marked as being from the<br />

files by the Collector RLIB directive.<br />

E,element-list<br />

Where element-list is a list of element names separated by commas specifying<br />

that the elements named should be treated as if they were RLIB$ elements for<br />

the purposes of RLIB$ trace suppression. The specified list completely replaces<br />

any preceding list. If a “+” sign follows the E, the listed elements are added to<br />

the current list. A maximum of 16 names can be specified. An empty list is<br />

specified by following the “E” with punctuation other than a comma, a plus sign,<br />

or a question mark. “RLIB E?” prints the current list.<br />

7833 1733–004 24–15


Program Trace Routine<br />

SET<br />

L<br />

N<br />

Prints the system type, system level identification, and site as well as the RLIB$<br />

level used at collection time.<br />

Suppresses trace printout of RLIB$ code and common banks. When tracing of<br />

RLIB$ is suppressed (which is the default mode for demand operations), an<br />

RLIB$ code is entered. The print mode is in effect saved. Printing is then<br />

turned off, and the RLIB$ code is interpreted until control leaves RLIB$ code. At<br />

this time, the print mode is restored and normal execution continues. This<br />

command may be used at any time. If it is used to change the mode while the<br />

program is in RLIB$ code, the effect will be as if RLIB$ was just exited (from N<br />

to A) or entered (from A to N). This means that the print mode will be saved or<br />

restored, respectively.<br />

X,element-list<br />

Has syntax identical to that for "RLIB E", but the effect is inverted. That is, any<br />

element not contained in the RLIB X list will be treated as an RLIB$ element.<br />

Use RLIB X+ to extend the line.<br />

If a break interrupt happens to give control in RLIB$ (or pseudo-RLIB$) code and<br />

RLIB$ tracing is suppressed, the STEP command and the blank line command are<br />

disabled. This prevents losing control when a blank line is transmitted by the break<br />

contingency under certain EXEC levels. Be sure to turn off printing or else allow<br />

RLIB$ tracing so that a runaway print can be avoided.<br />

Sets one or more flags. List the flags by name. The names must be separated by<br />

commas. See the STATUS command for flag names and meanings.<br />

SKIP n (S)<br />

Returns to command mode after executing n number of instruction cycles. If n is<br />

omitted, any previously existing skip count is deleted and no skip interrupt occurs.<br />

Otherwise, an octal number is used to set the interrupt point. If the count is<br />

exceeded during an indirect addressing or execute remote cascade, the command<br />

mode is reentered when the instruction is completed.<br />

24–16 7833 1733–004


STATUS<br />

Program Trace Routine<br />

Prints the status of any or all flags. Use the STATUS? command to print all flags.<br />

Otherwise, these flags may be listed, separated by commas. The flags are as<br />

follows:<br />

STEP n<br />

Name Action If Set<br />

BYPADD Bypasses @ADD images when looking for a SNOOPY command.<br />

NOHDG SNOOPY sign-on and sign-off information is suppressed.<br />

UXUCOR The u-field is looked up in SYMTB$ for J = U (016) or XU (017) when<br />

the x-field is zero.<br />

Executes n instructions in trace mode and returns to command mode. Default for n<br />

is one.<br />

TOFF$ (T)<br />

TON$<br />

TRAP<br />

Leaves the trace mode and continues execution as if an SLJ TOFF$ command had<br />

been executed. Trace mode is then terminated, and the last instruction is printed.<br />

Restarts a trace that will be terminated and executes one instruction. To compute<br />

the number of instruction cycles performed, use the TOFF$ command followed by<br />

the TON$ command. The TON$ command is not affected if the activity is about to<br />

terminate by means of an EXIT$ request; to continue tracing from that point, use a<br />

JUMP command to first establish a point from which execution will continue.<br />

Enters command mode from trace mode whenever one of a set of locations is<br />

referenced or altered except for ER operations. The locations may be octal numbers,<br />

register mnemonics, or external symbols. Entering the command<br />

“TRAPloc-1,loc-2...” places up to 16 locations in the trap table for the locators. Use<br />

commas as separators.<br />

If an asterisk immediately follows “TRAP”, the trap occurs only when a location's<br />

contents are changed. If the change occurs by using an Executive Request or<br />

asynchronously, the trap occurs at the next reference. If an exclamation point<br />

immediately follows “TRAP”, the trace does not stop when a trapped location<br />

changes. The old and new values are displayed, even in “PRINT N” mode.<br />

The use of external symbols is subject to the restrictions noted for the ABSAD<br />

command. Each specified list completely replaces the preceding list unless TRAP is<br />

followed immediately with a + (intervening spaces not allowed). In this case, the<br />

specifications are added to the list. The command “TRAP?” prints out the current<br />

list. See CHANGE command for use of the symbol $.<br />

7833 1733–004 24–17


Program Trace Routine<br />

24.5. Control Flags<br />

The location of some of SNOOPY's control flags is externalized with the label SNFLG$.<br />

In addition, the system procedure SN$DEF provides mnemonic tags for the following<br />

flags:<br />

BYPADD<br />

CCALL<br />

Set to bypass from @ADD streams when reading a SNOOPY command.<br />

(SNFLG$+2,,S2)<br />

Set by SNCNT$, cleared by SNCLR$. (SNFLG$,,S2)<br />

CMODE<br />

Set when tracing a contingency routine. (SNFLG$+1,,S2)<br />

COMPRT<br />

Set for compressed print ("PRINT C"), clear for expanded print. (SNFLG$+1,,S3)<br />

CONTINGF<br />

ECHO<br />

Set when a contingency has occurred, otherwise clear. (SNFLG$,,S5)<br />

Set for echo mode of ALTPRT. (SNFLG$+1,,S6)<br />

NOHDG<br />

Suppresses SNOOPY sign-on and sign-off messages. (SNFLG$+2,,S4)<br />

OLDSKP<br />

Saved value of REMSKPIT when RLIB$T = 0 and WASRLB = 1. (SNFLG$+1,,S5)<br />

REMBRK<br />

Set when the break contingency has occurred or by encountering a condition set by<br />

the SKIP (or number) command, the BREAK command, or the TRAP command.<br />

When set, SNOOPY enters command mode before interpreting the next instruction.<br />

(SNFLG$,,S6)<br />

REMOTE<br />

Clear for batch mode, set for demand mode. (SNFLG$,,S1)<br />

24–18 7833 1733–004


REMPRT<br />

Program Trace Routine<br />

Set for partial-print mode ("PRINT P"), clear for full-print mode. (SNFLG$,,S3)<br />

REMSKPIT<br />

RLIBX<br />

Set for suppress print mode ("PRINT N"), clear for full- or partial-print mode.<br />

(SNFLG$,,S4)<br />

RLIB$T<br />

Set if RLIB list is in exception mode, otherwise clear. (SNFLG$+2,,S1)<br />

Set to enable RLIB$ tracing ("RLIB A"), clear to suppress RLIB$ tracing (“RLIB N”).<br />

(SNFLG$+1,,S4)<br />

UXUCOR<br />

Set to look up u-fields in SYMTB$ when x-field is zero and j-field is U (016) or<br />

XU (017). (SNFLG$+2,,S3)<br />

WASRLB<br />

Set when executing an RLIB$ or pseudo-RLIB$ element. (SNFLG$+1,,S1).<br />

7833 1733–004 24–19


Program Trace Routine<br />

24–20 7833 1733–004


Section 25<br />

SOR–Symbolic Output Routine<br />

The Symbolic Output Routine (SOR) writes symbolic images produced by a processor<br />

into a program file as a symbolic element. The symbolic element produced by SOR is<br />

suitable for input to another processor by SIR$.<br />

The symbolic output produced by SOR should not be confused with the symbolic output<br />

produced by SIR$, described in Section 23. The symbolic output produced by SIR$ is<br />

based on the source input (SI) file or element, as modified by optional runstream<br />

corrections. The symbolic output produced by SOR is independent of the SIR$ symbolic<br />

output and is completely under control of the calling processor. SOR would normally be<br />

used by a processor that produces symbolic output rather than relocatable, omnibus,<br />

absolute, or object module output.<br />

The calling program must supply a 40-word PARTBL that is zero filled. The name<br />

PARTBL must be externally defined. See Figure 14–1 for PARTBL description. For<br />

symbolic output, SOR uses words 27 through 39 of PARTBL, the table item normally<br />

used for relocatable output.<br />

The calling program must insert the following information in PARTBL before calling SOR.<br />

The PREPRO routine can be used to enter the information from the second field<br />

(relocatable output) of the processor call statement to PARTBL.<br />

PARTBL+27,+28 Internal file name<br />

PARTBL+29,+30 Element name<br />

PARTBL+33,+34 Version name<br />

7833 1733–004 25–1


SOR–Symbolic Output Routine<br />

SOR inserts the following:<br />

S2 of PARTBL+32 Bit 7, the ASCII bit, is zero if the first symbolic image written by<br />

SOR is Fieldata; otherwise, the ASCII bit is set to 1.<br />

S3 of PARTBL+32 Element type is set to (01-symbolic).<br />

T1 of PARTBL+35 Cycle limit is set to the system standard (CYCLIM$).<br />

T2 of PARTBL+35 Latest cycle number is set to zero.<br />

T3 of PARTBL+35 Current number of cycles is set to 1.<br />

S1 of PARTBL+36 Element subtype is set to 01 (ELT).<br />

H2 of PARTBL+36 Length of text.<br />

PARTBL+37 Location of text.<br />

PARTBL+38 Time and date element created. Initialized to zero by SSOR$<br />

routine. User may insert time and date after SSOR$ call;<br />

otherwise, current time and date will be used.<br />

PARTBL+39 Next write location in program file.<br />

25.1. SSOR$–Start Symbolic Output<br />

SSOR$ initializes the SOR routine by setting up the appropriate PARTBL fields and by<br />

opening the System Data Format Output (SDFO) routine.<br />

Calling Sequence<br />

LMJ X11,SSOR$<br />

error return<br />

normal return<br />

SSOR$ initializes and makes PARTBL entries for a symbolic element. If the calling<br />

program also calls SIR$ and if the same file is used for both SIR$ source output and SOR<br />

symbolic output, then SSOR$ should not be called until SIR$ has created its source<br />

output, which occurs at the end of the first pass through SIR$. This is necessary<br />

because the text location for SOR symbolic output cannot be correctly determined using<br />

ER PFWL$ until SIR$ has created its source output element. The SDFO packet with the<br />

external label SORFCT$ is opened for SOR symbolic output.<br />

The calling program receives control at the error return if ER PFWL$ encounters an error<br />

condition. (See the Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>) On an error return,<br />

register A2 is nonzero, and contains the ER PFWL$ status.<br />

25–2 7833 1733–004


SOR–Symbolic Output Routine<br />

25.2. SORASC$ and SORASCA$–Output ASCII<br />

Image<br />

The SORASC$ and SORASCA$ routines write an ASCII image from a location specified<br />

by the calling program to the symbolic output element.<br />

Calling Sequence<br />

L A0,(image-length,image-location)<br />

LMJ X11,SORASC$ (or SORASCA$)<br />

error return<br />

normal return<br />

where:<br />

image-length<br />

The length in words of the symbolic image to output.<br />

image-location<br />

The address of the symbolic image to output.<br />

If this is the first call to output an image, SOR calls SDFO to write the SDF Label control<br />

record. If the SORASC$ entry point is called, SOR checks for and suppresses words of<br />

ASCII spaces at the end of the image. If the SORASCA$ entry point is called, there is no<br />

space suppression and image-length words are written. SOR calls SDFO to write the<br />

symbolic image.<br />

The following are the causes of SOR error returns:<br />

• If the image-location is zero but the image-length is nonzero, SOR returns with A5<br />

zero.<br />

• If an unrecoverable SDFO I/O error is encountered, SOR returns with A5 containing<br />

the nonzero I/O error status code.<br />

• If the image-length is over the maximum of 2,047 words, SOR returns with A5<br />

containing the illegal word count.<br />

7833 1733–004 25–3


SOR–Symbolic Output Routine<br />

25.3. Output Fieldata Image<br />

The SOR$ and SORA$ routines translate into ASCII a Fieldata image from a location<br />

specified by the calling program and write it to the symbolic output element.<br />

Calling Sequence<br />

L A0,(image-length,image-location)<br />

LMJ X11,SOR$ (or SORA$)<br />

error return<br />

normal return<br />

where:<br />

image-length<br />

The length in words of the symbolic image to output.<br />

image-location<br />

The address of the symbolic image to output.<br />

If this is the first call to output an image, SOR calls SDFO to write the SDF Label control<br />

record. If the SOR$ entry point is called, SOR checks for and suppresses words of<br />

Fieldata spaces at the end of the image. If the SORA$ entry point is called, there is no<br />

space suppression. If this is the first call to SOR$ or SORA$, SOR prints the following<br />

informational message:<br />

SOR: Fieldata symbolic output in not allowed; output is in ASCII.<br />

SOR then translates the Fieldata image to ASCII. The buffer that SOR uses for the<br />

translation is 63 words long, so if the Fieldata image is 42 words or less, SOR translates<br />

the image and then calls SDFO to write it. If the Fieldata image is more than 42 words,<br />

the entire image cannot be translated and written at once. In this case, SOR calls SDFO<br />

to write the first 63 words of the translated image; then continues by translating the next<br />

part of the Fieldata image and calling SDFO to write it as an SDF Continuation control<br />

record, octal code 051. SOR continues writing Continuation control records until the<br />

entire Fieldata image has been translated and written.<br />

To write a Fieldata image to the symbolic output element in Fieldata, the calling program<br />

can use the SORNM$ or SORNMA$ calls described in 25.4. Note also that SOR can be<br />

configured so that the SOR$ and SORA$ entry points write Fieldata images with no<br />

translation to ASCII.<br />

The SOR error returns described for SORASC$ and SORASCA$ in 25.2 also apply to<br />

SOR$ and SORA$.<br />

25–4 7833 1733–004


SOR–Symbolic Output Routine<br />

25.4. SORNM$ and SORNMA$–Output Specified<br />

Coded Character Set Image<br />

The SORNM$ and SORNMA$ routines write, without translation, an image from a<br />

location specified by the calling program to the symbolic output element. The coded<br />

character set (CCS) of the image is specified by the calling program.<br />

Calling Sequence<br />

L A0,(image-length,image-location)<br />

L,U A1,CCS-identifier<br />

LMJ X11,SORNM$ (or SORNMA$)<br />

error return<br />

normal return<br />

where:<br />

image-length<br />

The length in words of the symbolic image to output.<br />

image-location<br />

The address of the symbolic image to output.<br />

CCS-identifier<br />

The CCS of the symbolic image, as described in Table I–1. The calling program is<br />

responsible for assuring that the symbolic image has the correct format for the<br />

specified CCS. Note that CCS octal 076 is reserved for future use and is currently<br />

illegal.<br />

If this is the first call to output an image, SOR calls SDFO to write the SDF Label control<br />

record. If this is not the first call to output an image, SOR checks if the CCS identifier for<br />

the image to be written is the same as the CCS of the previous symbolic image. If it is<br />

not, SOR calls SDFO to write a Character Set Change control record, octal code 042.<br />

This control record indicates the CCS of one or more symbolic images that follow.<br />

The SORNM$ entry point is called to request space suppression at the end of the image.<br />

If this is a Fieldata image (CCS 0), SOR checks for and suppresses words of Fieldata<br />

spaces. If this is an ASCII image (CCS 1) or an image in one of the 39 CCSs listed in<br />

Table I–1 as “ASCII-like,” SOR checks for and suppresses words of ASCII spaces. If this<br />

is an image in one of the 22 CCSs that is not Fieldata, ASCII, or ASCII-like, SOR checks<br />

for and suppresses words of binary zeroes. If the SORNMA$ entry point is called, there<br />

is no space suppression.<br />

The SOR error returns described for SORASC$ and SORASCA$ in 25.2 also apply to<br />

SORNM$ and SORNMA$. The following error return is unique for SORNM$ and<br />

SORNMA$: If the CCS-identifier is not a legal CCS (A1 is negative, equal to octal 076 or<br />

over octal 077), SOR returns with A5 (H1) equal to 1 to indicate a CCS identifier error and<br />

A5 (H2) equal to the CCS identifier.<br />

7833 1733–004 25–5


SOR–Symbolic Output Routine<br />

25.5. ESOR$–End Symbolic Output<br />

ESOR$ terminates the operations of the SOR routine.<br />

Calling Sequence<br />

LMJ X11,ESOR$<br />

error return<br />

normal return<br />

ESOR$ terminates SOR, closes SDFO, and inserts the generated element in the<br />

program file (ER PFI$). If SOR takes the error return from ER PFI$, register A5 equals<br />

zero; register A2 contains the descriptive code. If the error return is from SDFO, an<br />

(unrecoverable) I/O error occurred and register A5 contains the I/O status code.<br />

25.6. SOR File Control Table (SORFCT$)<br />

The file control table (FCT) and the buffers provided by SOR for SDFO are similar to<br />

those SDFI requires. Therefore, the external label SORFCT$ is provided for the first<br />

word of the FCT.<br />

Although SORFCT$ is initially zero, it is set to nonzero when SSOR$ is called; SORFCT$<br />

is reset to zero when ESOR$ is called. If SORFCT$ is nonzero when SSOR$ is called, a<br />

01 (no find) error condition is returned in register A2. If the calling program uses the FCT<br />

and SOR buffers, it must do the following:<br />

• Check that SORFCT$ is zero before using it.<br />

• Set SORFCT$ to zero while using it.<br />

• Reset SORFCT$ to zero when it is no longer required.<br />

• Be sure S2 of SORFCT$+3 is the correct I/O code.<br />

Note: SIR$ has its own input FCT and buffers for SDFI use.<br />

25–6 7833 1733–004


Appendix A<br />

Using <strong>SYSLIB</strong><br />

This appendix contains suggestions for using <strong>SYSLIB</strong>.<br />

A.1. Efficient Collections<br />

Under certain conditions, the efficiency of the Collector can be improved when using<br />

<strong>SYSLIB</strong> relocatable elements. These conditions are:<br />

• <strong>SYSLIB</strong> has been installed with COMUS level 4R2 or higher.<br />

• The Exec level is 40R1 or higher.<br />

• The Collector level is 31R2 or higher.<br />

• The <strong>SYSLIB</strong> elements are not explicitly included with the “IN file-name.elementname”<br />

directive.<br />

If these conditions are met, programs that call <strong>SYSLIB</strong> routines should use the MASM<br />

INFO 12 directive. This directive instructs the Collector to search the library file<br />

SYS$LIB$*<strong>SYSLIB</strong> before searching other library files. The format of the INFO 12<br />

directive is<br />

$INFO 12 '<strong>SYSLIB</strong>'<br />

where ‘<strong>SYSLIB</strong>’ is the keyword for the SYS$LIB$*<strong>SYSLIB</strong> file. For details, see the<br />

MASM <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

A.2. PLUS Routines<br />

When any <strong>SYSLIB</strong> routines written in PLUS are used, the PLUS library must be available<br />

when collecting programs. SAR$ is the only <strong>SYSLIB</strong> routine that is currently written in<br />

PLUS. If PLUS is installed with COMUS or is included in the SYS$RLIB$ file, the<br />

Collector will automatically include referenced PLUS elements. IF PLUS is installed in a<br />

different file, it may be necessary to use the Collector LIB directive of MAP$PF use<br />

name. See the Collector <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> for more information on the<br />

Collector LIB.<br />

A.3. Compilations<br />

Attach MASM$PF or PLS$PF to file SYS$LIB$*<strong>SYSLIB</strong>, or the file containing <strong>SYSLIB</strong>,<br />

and assign it to the run. This will decrease the assembly and compilation time. Use the<br />

M option with PLS.<br />

7833 1733–004 A–1


Using <strong>SYSLIB</strong><br />

A–2 7833 1733–004


Appendix B<br />

Diagnostic Messages<br />

This appendix contains processor interface routine messages and SIR$ line-change<br />

diagnostics.<br />

B.1. Processor Interface Routine Messages<br />

In the following messages, x may be either si, ro, or so, corresponding to the parameters<br />

on the processor call statement.<br />

The following messages are produced by the Processor Interface Routines:<br />

ABNORMAL RETURN FROM READ$<br />

A program which expects to be called as a processor has been called with @XQT.<br />

x BADLY CODED FIELD<br />

Fill from previous parameter was requested, and the filled parameter is illegal or<br />

ambiguous.<br />

x CYCLE SPECIFICATION IGNORED<br />

ro and so cycle specification is meaningless and is ignored. Does not cause error<br />

return.<br />

x FILE CANNOT BE READ<br />

Input file is in read-inhibited mode due to absence of read-key, write-only mode is<br />

set for file, or Y option is used on the file assignment.<br />

x FILE ERROR WAS REPORTED BY ER z - STATUS IN A2 = n<br />

Error status was received when acquiring file information using an OS 2200 program<br />

file package (PFP) request. z is the mnemonic of the ER and n is the PFP status<br />

code. See the Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

x FILE IS TAPE<br />

ro and so may not specify tape files.<br />

7833 1733–004 B–1


Diagnostic Messages<br />

x FILE NOT AVAILABLE - STATUS: n<br />

An attempt to assign a file has failed. Status n is the facility request status code.<br />

See the Exec ER <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

FILE NOT ASSIGNED: x<br />

POSTPR$ has tried to release (@FREE) a file that was not assigned. The calling<br />

program has probably altered PARTBL.<br />

x ILLEGAL DEVICE<br />

Output file is not sector-formatted or input file is neither tape nor sector-formatted.<br />

x ILLEGAL FIELD<br />

The field is ambiguous with the option given; that is, I option is specified and the<br />

symbolic output parameter is specified.<br />

INVALID SDF LABEL WORD w<br />

An attempt was made to process an invalid SDF file or element. w is the first two<br />

words printed in Fieldata.<br />

I/U OPTION CONFLICT<br />

Both I and U options were given on processor call statement. This situation is<br />

ambiguous.<br />

x NOT A PROGRAM FILE<br />

The file specified may not be used as a program file.<br />

PROCESSOR CALL ERROR<br />

A program which expects to be called as a processor has been called with @XQT.<br />

x READ ONLY OUTPUT FILE<br />

Output file is in a write inhibited mode, due to absence of write-key, read-only mode<br />

set for file, or Y option is used on the file assignments.<br />

SIR$: OUTPUT OF CCS 076 IMAGE NOT ALLOWED<br />

CCS 076 is reserved for future use and is currently illegal. SIR$ does not write<br />

images in this CCS to the source output.<br />

SIR$: OUTPUT OF CCS 0nn IMAGE REQUIRES ‘P’ AND ‘Q’ OPTIONS<br />

Octal CCS 0nn is not Fieldata, ASCII, or ASCII-like. SIR$ only writes images in this<br />

CCS if both the P and the Q options are either assumed or explicitly included on the<br />

processor call.<br />

B–2 7833 1733–004


SIR$: RETURN OF CCS 076 IMAGE NOT ALLOWED<br />

Diagnostic Messages<br />

CCS 076 is reserved for future use and is currently illegal. SIR$ does not pass<br />

images in this CCS to the calling program.<br />

SIR$: RETURN OF CCS 0nn IMAGE REQUIRES SPECIAL SIR$ INITIALIZATION<br />

SIR$ must be initialized using the INISR$ entry point with A4 bit 2 set to 1 in order to<br />

return images in octal CCS 0nn.<br />

SIR$: RETURN OF CCS 0nn IMAGE REQUIRES SPECIAL SIR$ INITIALIZATION AND USE<br />

OF GETNM$<br />

SIR$ must be initialized using the INISR$ entry point with A4 bit 2 set to 1 and the<br />

calling program must use the GETNM$ entry point in order to return images in octal<br />

CCS 0nn.<br />

SIR$: RETURN OF CCS 0nn IMAGE REQUIRES USE OF GETNM$<br />

The calling program must use the GETNM$ entry point to return images in octal CCS<br />

0nn.<br />

SI: CYCLE NONEXISTENT OR IN ERROR<br />

Requested cycle of specified element does not exist or cycle field has improper<br />

format.<br />

SI: ELEMENT NOT FOUND<br />

Element name given cannot be found as a symbolic element in the specified<br />

program file.<br />

SI: IMPROPER LABEL BLOCK<br />

Symbolic input file is tape, and tape is not positioned at the label block for requested<br />

element, probably because an @FIND has not been performed.<br />

SI IS NOT SIR TYPE SDF<br />

The SDF type is not S (general symbolic) or unspecified; therefore the input element<br />

is assumed to contain no valid cycle information.<br />

SI: MISSING FIELD<br />

A field of required information (for example, element name) was not given.<br />

SI: TAPE I/O ERROR — STATUS: n<br />

Symbolic input file is tape, and I/O status is n.<br />

7833 1733–004 B–3


Diagnostic Messages<br />

SIR EDIT ERR c l<br />

c indicates the cause of the error, and l represents the line number of the last image<br />

retrieved from the input symbolic before the error occurred or before the change<br />

statement in error.<br />

TOO MANY SPECIFICATIONS<br />

A processor call statement is too complex.<br />

B.2. SIR$–Line-Change Diagnostics<br />

When an error occurs, SIR$ passes a print control word in control register A0 back to the<br />

calling processor. Normally the processor performs an ER PRINT$ to inform the caller of<br />

the error. No other image is returned to the processor on an error return. The formats<br />

of the error messages are:<br />

Format 1<br />

SIR EDIT ERR c l<br />

Format 2<br />

c l<br />

where:<br />

c<br />

l<br />

Indicates the cause of the error. Table B–1 lists the possible errors.<br />

Is the line number of the last image retrieved from the input symbolic before the<br />

error occurred or before the change statement in error.<br />

Format 1 is returned when a partial-line-change editing statement is in error. Format 2 is<br />

returned when a line-change or partial- line-change statement is in error.<br />

SIR$ does not make assumptions as to the format of a changed line. Information in<br />

fixed fields—for example, sequence numbers in columns 73 through 80—may be<br />

destroyed when using partial-line-changes, especially formats 2 and 4.<br />

B–4 7833 1733–004


Table B–1. SIR$: Line-change Diagnostics<br />

Error Description<br />

ASCII OUTPUT TRUNCATED Overflow occurred on Fieldata to ASCII translation.<br />

Diagnostic Messages<br />

CARD COUNT < Not enough editing statements were provided. Those lines<br />

for which no editing statement was provided remain<br />

unchanged.<br />

CARD COUNT > Too many editing statements were provided. The excess<br />

editing statements are ignored.<br />

COLUMN The column number specified in Format 1 or 2 editing<br />

statement is out of range or c > d for a Format 2 editing<br />

statement.<br />

COMPRESSED SYMBOLIC<br />

FORMAT ERROR<br />

EDIT OF CCS 0nn<br />

IMAGE NOT ALLOWED<br />

EDITING STATEMENT IN<br />

CCS 0nn NOT ALLOWED<br />

NO CARDS FOLLOW -n No change lines follow -n.<br />

A compressed symbolic image exceeded the maximum<br />

image length when expanded. The remainder of the input<br />

image is ignored.<br />

A source input line referenced by a partial line change<br />

statement is in octal CCS 0nn, which is not Fieldata, ASCII,<br />

or ASCII-like and cannot be edited.<br />

A partial line change editing statement is in octal CCS 0nn,<br />

which is not Fieldata, ASCII, or ASCII-like as required.<br />

NO FIND The characters given in the old-data parameter of a format 3<br />

or 4 editing statement could not be found in the line being<br />

changed.<br />

Whenever a NO FIND, SEPARATOR, or COLUMN error<br />

occurs, the editing statement is ignored and the line remains<br />

unchanged except format -n, where the last changed image<br />

is returned.<br />

OUT OF SEQ The line-change or partial-line-change statement is illegal.<br />

PREMATURE @EOF An end of file encountered when reading compressed<br />

symbolic images. An image has probably been lost.<br />

SEPARATOR The separator used in the editing statement is invalid or<br />

nonexistent.<br />

SI ENDS AT LINE NUMBER n The line-change or partial-line-change references a line after<br />

the last line of the input symbolic. Line number n is the last<br />

line of the symbolic.<br />

7833 1733–004 B–5


Diagnostic Messages<br />

B–6 7833 1733–004


Appendix C<br />

<strong>SYSLIB</strong> Restrictions<br />

This appendix explains the restrictions of using <strong>SYSLIB</strong>.<br />

C.1. ASM Compatibility<br />

<strong>SYSLIB</strong> levels 75R2 and higher are not compatible with OS 2200 Assembler (ASM) level<br />

15R1. ASM routines that use PROCs from <strong>SYSLIB</strong> levels 75R2 or higher may or may not<br />

assemble correctly with ASM. If they do not, the routines should be assembled with<br />

MASM (any supported level).<br />

C.2. Object Modules<br />

The only elements released in <strong>SYSLIB</strong> as object modules are ERU$ and SYS$DEF. All<br />

other <strong>SYSLIB</strong> elements cannot be used as object modules. However, the subset of<br />

<strong>SYSLIB</strong> routines in the <strong>SYSLIB</strong> common banks can be accessed from object modules.<br />

SLIB provides equivalent services for the extended mode environment.<br />

C.3. SDFI and SDFO Tape Handling<br />

SDFI and SDFO are not compatible with PCIOS levels 4R1 and 4R1A when handling<br />

multireel tape files.<br />

When SDFI reads multireel tape files created by PCIOS, I/O error 01 (unlabeled tape) or<br />

ER TLBL$ error 013 (labeled tape) occurs. When PCIOS reads multireel tape files<br />

created by SDFO, unlabeled tapes are read correctly, but labeled tapes encounter I/O<br />

error 01.<br />

C.4. Symbolic Access Routine (SAR$)<br />

SAR$ does not process data that is made up only of JIS-16 (kanji) characters. But SAR$<br />

does process kanji characters when they are part of ASCII/ISO shift-coded data and<br />

attributed character data (ACD).<br />

C.5. 65K Addressing Limit<br />

The elements PREPF$, POSTPR$, PREPRM, PREPRO, ROR, and SOR cause truncation<br />

errors during collection if they are located above 65K in the D-bank.<br />

7833 1733–004 C–1


<strong>SYSLIB</strong> Restrictions<br />

C–2 7833 1733–004


Appendix D<br />

<strong>SYSLIB</strong> Elements<br />

This appendix contains a complete list of all <strong>SYSLIB</strong> elements.<br />

The <strong>SYSLIB</strong> elements are listed alphabetically in Table D–1, along with the element type,<br />

common bank it resides in, and element size. The name of the common bank absolute<br />

is listed if the element is contained in a <strong>SYSLIB</strong> common bank. The approximate<br />

element size in words is listed if the element is a relocatable element (rounded to the<br />

nearest 0100). All size values are in octal.<br />

Table D–1. <strong>SYSLIB</strong> Elements<br />

Element Name Element Type Common Bank Size<br />

AEDIT$ Relocatable <strong>SYSLIB</strong>$1 0400<br />

AEDIT$F Relocatable <strong>SYSLIB</strong>$1 0500<br />

AEDIT$P Assembler Procedure<br />

AEDIT$SFDT Relocatable <strong>SYSLIB</strong>$1 0300<br />

AEDIT$T Relocatable <strong>SYSLIB</strong>$1 0200<br />

AXR$ Assembler Procedure<br />

A$ACD2INT Relocatable <strong>SYSLIB</strong>$3 0700<br />

A$INT2ACD Relocatable <strong>SYSLIB</strong>$4 01000<br />

A$INT2SC Relocatable <strong>SYSLIB</strong>$4 0600<br />

A$SC2INT Relocatable <strong>SYSLIB</strong>$3 0300<br />

BSP$ Relocatable <strong>SYSLIB</strong>$1 02500<br />

BUF$TRANS Omnibus<br />

CABSAD$ Relocatable <strong>SYSLIB</strong>$1 0500<br />

CBEPFORV$ Relocatable 0<br />

CBEPMDP$ Relocatable 0<br />

CBEPUTS4$ Relocatable 0<br />

CBEP$$DMS Relocatable 0<br />

CBEP$$EMSLIB Omnibus<br />

CBEP$$MS Relocatable 0<br />

CBEP$$PIRCB$ Relocatable 0<br />

7833 1733–004 D–1


<strong>SYSLIB</strong> Elements<br />

Table D–1. <strong>SYSLIB</strong> Elements<br />

Element Name Element Type Common Bank Size<br />

CBEP$$<strong>SYSLIB</strong> Relocatable 0<br />

CB$CONFIG Omnibus<br />

CB$RETURNS Relocatable 0<br />

CERU$ Relocatable 0<br />

CERU$ Symbolic<br />

CONWRD$ Relocatable <strong>SYSLIB</strong>$1 0100<br />

CRELAD$ Relocatable <strong>SYSLIB</strong>$1 0500<br />

DLOAD$ Relocatable 0100<br />

EDIT$ Relocatable 0400<br />

EDIT$F Relocatable 0500<br />

EDIT$P Assembler procedure<br />

EDIT$T Relocatable 0200<br />

EM$BSP$ICPT Relocatable <strong>SYSLIB</strong>$1 0200<br />

EM$EDIT$ICPT Relocatable <strong>SYSLIB</strong>$1 0100<br />

EM$ERS Relocatable <strong>SYSLIB</strong>$1 0100<br />

EM$FDA$ICPT Relocatable <strong>SYSLIB</strong>$3 0100<br />

EM$INF$ICPT Relocatable <strong>SYSLIB</strong>$1 0100<br />

EM$MFD$ICPT Relocatable <strong>SYSLIB</strong>$2 0100<br />

EM$PSF$ICPT Relocatable <strong>SYSLIB</strong>$1 0100<br />

EM2CB$P Omnibus<br />

ERU$ Absolute (Object Module)<br />

ERU$ Omnibus<br />

ERU$ Relocatable 0<br />

ERU$ Symbolic<br />

ER$APRTCN$WD Omnibus<br />

ER$APRTCN$WI Omnibus<br />

ER$BRKPT Omnibus<br />

ER$COM$ Omnibus<br />

FDASC$ Relocatable <strong>SYSLIB</strong>$3 0200<br />

FDASC$PKTD Symbolic<br />

GETPSF$ Relocatable <strong>SYSLIB</strong>$1 0100<br />

IDLAD$ Relocatable 0100<br />

D–2 7833 1733–004


Table D–1. <strong>SYSLIB</strong> Elements<br />

Element Name Element Type Common Bank Size<br />

IDLA$ Relocatable 0100<br />

IDLD$ Relocatable 0100<br />

IDLINE$ Relocatable 0200<br />

IDL$ Relocatable 0100<br />

IDONLY$ Relocatable 0100<br />

ID$ Relocatable <strong>SYSLIB</strong>$1 0400<br />

INFOR$ Relocatable <strong>SYSLIB</strong>$1 0400<br />

MAXR$ Omnibus<br />

MFDSP$ Relocatable <strong>SYSLIB</strong>$2 01700<br />

OM$DEF Omnibus<br />

PIRCB$INTCPT Relocatable 0200<br />

PLSG$ID$ Relocatable 0100<br />

PLSG$SFDT$ Relocatable 0100<br />

PLS$ER$PFI$ Relocatable <strong>SYSLIB</strong>$4 0100<br />

PLS$FDASC$ Relocatable <strong>SYSLIB</strong>$3 0100<br />

PLS$ID$ Relocatable 0100<br />

PLS$SDFI Relocatable <strong>SYSLIB</strong>$3 0200<br />

PLS$SDFO Relocatable <strong>SYSLIB</strong>$4 0200<br />

PLS$SFDT$ Relocatable 0100<br />

PLS$SYMB$ Relocatable <strong>SYSLIB</strong>$3 0100<br />

POSTPR$ Relocatable 0100<br />

PREPF$ Relocatable 0500<br />

PREPRM Relocatable 01300<br />

PREPRO Relocatable 01400<br />

PROC$ Assembler procedure<br />

ROR Relocatable 0700<br />

SAR$ATREAD$G Relocatable <strong>SYSLIB</strong>$3 0700<br />

SAR$ATRPKTD Symbolic<br />

SAR$ATR$DG Symbolic<br />

SAR$COMPKTD Symbolic<br />

SAR$COM$DG Symbolic<br />

SAR$COM$G Relocatable <strong>SYSLIB</strong>$3 0400<br />

<strong>SYSLIB</strong> Elements<br />

7833 1733–004 D–3


<strong>SYSLIB</strong> Elements<br />

Table D–1. <strong>SYSLIB</strong> Elements<br />

Element Name Element Type Common Bank Size<br />

SAR$DEFN Symbolic<br />

SAR$FILEPKTD Symbolic<br />

SAR$PROCS Assembler procedure<br />

SAR$READ$DG Symbolic<br />

SAR$READ$G Relocatable <strong>SYSLIB</strong>$3 02300<br />

SAR$RPKTD Symbolic<br />

SAR$WPKTD Symbolic<br />

SAR$WRITE$DG Symbolic<br />

SAR$WRITE$G Relocatable <strong>SYSLIB</strong>$4 03400<br />

SDFI Relocatable <strong>SYSLIB</strong>$3 0500<br />

SDFI$PKTD Symbolic<br />

SDFO Relocatable <strong>SYSLIB</strong>$4 0400<br />

SDFO$PKTD Symbolic<br />

SDFP$ Omnibus<br />

SFDTBL$ Relocatable <strong>SYSLIB</strong>$1 0100<br />

SFDT$ Relocatable <strong>SYSLIB</strong>$1 0400<br />

SFDT$D Symbolic<br />

SIR$ Relocatable 04400<br />

SNAP$ Relocatable 0200<br />

SNOOPY Relocatable 011300<br />

SOR Relocatable 0400<br />

SSTYP$ Relocatable 0100<br />

SYMB$PKTD Symbolic<br />

<strong>SYSLIB</strong>$ID Relocatable 0<br />

<strong>SYSLIB</strong>$1-EP Relocatable <strong>SYSLIB</strong>$1 0400<br />

<strong>SYSLIB</strong>$2-EP Relocatable <strong>SYSLIB</strong>$2 0100<br />

<strong>SYSLIB</strong>$3-EP Relocatable <strong>SYSLIB</strong>$3 0100<br />

<strong>SYSLIB</strong>$4-EP Relocatable <strong>SYSLIB</strong>$4 0100<br />

SYS$DEF Absolute (object module)<br />

SYS$DEF Omnibus<br />

SYS$DEF Relocatable 0<br />

TABLE$ Relocatable <strong>SYSLIB</strong>$3 0200<br />

D–4 7833 1733–004


<strong>SYSLIB</strong> Elements<br />

Table D–2 contains the <strong>SYSLIB</strong> common bank absolute elements. The table includes the<br />

highest address of the common bank, rounded up to the next 0100. All <strong>SYSLIB</strong> common<br />

banks begin at address 01000.<br />

Table D–2. <strong>SYSLIB</strong> Common Bank Absolute Elements<br />

Element Name Element Type Highest Address<br />

PIRCB$ Absolute (common bank) 024000<br />

<strong>SYSLIB</strong>$1 Absolute (common bank) 011700<br />

<strong>SYSLIB</strong>$2 Absolute (common bank) 03200<br />

<strong>SYSLIB</strong>$3 Absolute (common bank) 013300<br />

<strong>SYSLIB</strong>$4 Absolute (common bank) 011200<br />

7833 1733–004 D–5


<strong>SYSLIB</strong> Elements<br />

D–6 7833 1733–004


Appendix E<br />

<strong>SYSLIB</strong> Common Bank Entry Points<br />

This appendix contains a list of all <strong>SYSLIB</strong> common bank entry points. The common<br />

bank entry points are listed in Table E–1 through Table E–4. They are grouped by the<br />

common bank absolute in which they reside. In each table, the entry points are grouped<br />

by routine, and both the relocatable and common bank entry points are listed.<br />

Table E–1 lists the routines and entry points for <strong>SYSLIB</strong> common bank <strong>SYSLIB</strong>$1.<br />

Table E–1. <strong>SYSLIB</strong>$1 Entry Points<br />

Element Name Relocatable Entry Point Common Bank Entry Point<br />

AEDIT$ AECHAR$ CBAECHAR$<br />

AECLEAR$ CBAECLEAR$<br />

AECOLN$ CBAECOLN$<br />

AECOL$ CBAECOL$<br />

AECOPY$ CBAECOPY$<br />

AEDCFZ$ CBAEDCFZ$<br />

AEDECF$ CBAEDECF$<br />

AEDECV$ CBAEDECV$<br />

AEDITR$ CBAEDITR$<br />

AEDITX$ CBAEDITX$<br />

AEDIT$ CBAEDIT$<br />

AEFD1$ CBAEFD1$<br />

AEFD2$ CBAEFD2$<br />

AEMSGR$ CBAEMSGR$<br />

AEMSG$ CBAEMSG$<br />

AEOCTF$ CBAEOCTF$<br />

AEOCTV$ CBAEOCTV$<br />

AEPACK$ CBAEPACK$<br />

AEPRINT$ CBAEPRINT$<br />

AESKIP$ CBAESKIP$<br />

7833 1733–004 E–1


<strong>SYSLIB</strong> Common Bank Entry Points<br />

Table E–1. <strong>SYSLIB</strong>$1 Entry Points<br />

Element Name Relocatable Entry Point Common Bank Entry Point<br />

AEDIT$F AEFLF1$ CBAEFLF1$<br />

AEFLF2$ CBAEFLF2$<br />

AEFLG1$ CBAEFLG1$<br />

AEFLG2$ CBAEFLG2$<br />

AEFLS1$ CBAEFLS1$<br />

AEFLS2$ CBAEFLS2$<br />

AEDIT$SFDT AESFDT$ CBAESFDT$<br />

BSP$ APTIA$ CBAPTIA$<br />

APTID$ CBAPTID$<br />

APTIS$ CBAPTIS$<br />

APTIU$ CBAPTIU$<br />

APTNL$ CBAPTNL$<br />

CPTIA$ CBCPTIA$<br />

CPTID$ CBCPTID$<br />

CPTIS$ CBCPTIS$<br />

CPTIU$ CBCPTIU$<br />

CPTNL$ CBCPTNL$<br />

EPTIA$ CBEPTIA$<br />

EPTID$ CBEPTID$<br />

EPTIS$ CBEPTIS$<br />

EPTIU$ CBEPTIU$<br />

EPTNL$ CBEPTNL$<br />

ETIA$ CBETIA$<br />

ETID$ CBETID$<br />

ETIS$ CBETIS$<br />

ETIU$ CBETIU$<br />

ETNL$ CBETNL$<br />

FPTIA$ CBFPTIA$<br />

FPTID$ CBFPTID$<br />

FPTIS$ CBFPTIS$<br />

FPTIU$ CBFPTIU$<br />

E–2 7833 1733–004


Table E–1. <strong>SYSLIB</strong>$1 Entry Points<br />

<strong>SYSLIB</strong> Common Bank Entry Points<br />

Element Name Relocatable Entry Point Common Bank Entry Point<br />

BSP$ (cont.) FPTNL$ CBFPTNL$<br />

PTATWT$ CBPTATWT$<br />

PTCTWT$ CBPTCTWT$<br />

PTETWT$ CBPTETWT$<br />

PTEWT$ CBPTEWT$<br />

PTFTWT$ CBPTFTWT$<br />

RFTI$ CBRFTI$<br />

RFTI$$ CBRFTI$$<br />

RPFAPT$ CBRPFAPT$<br />

RPFCPT$ CBRPFCPT$<br />

RPFEPT$ CBRPFEPT$<br />

RPFET$ CBRPFET$<br />

RPFFPT$ CBRPFFPT$<br />

WFTI$ CBWFTI$<br />

WPFAPT$ CBWPFAPT$<br />

WPFCPT$ CBWPFCPT$<br />

WPFEPT$ CBWPFEPT$<br />

WPFET$ CBWPFET$<br />

WPFFPT$ CBWPFFPT$<br />

CABSAD$ CABSAD$ CBCABSAD$<br />

CAINIT$ CBCAINIT$<br />

CBX$ CBCBX$<br />

CSX$ CBCSX$<br />

CSYMVL$ CBCSYMVL$<br />

CONWRD$ CWCLEAR$ CBCWCLEAR$<br />

CWSET$ CBCWSET$<br />

CRELAD$ CBN$ CBCBN$<br />

CRELAD$ CBCRELAD$<br />

CRINIT$ CBCRINIT$<br />

CSN$ CBCSN$<br />

EDESC$ CBEDESC$<br />

7833 1733–004 E–3


<strong>SYSLIB</strong> Common Bank Entry Points<br />

Table E–1. <strong>SYSLIB</strong>$1 Entry Points<br />

Element Name Relocatable Entry Point Common Bank Entry Point<br />

CRELAD$ (cont.) FHT$ CBFHT$<br />

GETPSF$ GETPSFN$ CBGETPSFN$<br />

GETPSF$ CBGETPSF$<br />

ID$ ID$ CBID$<br />

INFOR$ DUSE$ CBDUSE$<br />

RINF$ CBRINF$<br />

SELT$ CBSELT$<br />

SINF$ CBSINF$<br />

SFDT$ SFDT$ CBSFDT$<br />

STARTSFDT$ CBSTARTSFDT$<br />

Table E–2 lists the routines and entry points for <strong>SYSLIB</strong> common bank <strong>SYSLIB</strong>$2.<br />

Table E–2. <strong>SYSLIB</strong>$2 Entry Points<br />

Element Name Relocatable Entry Point Common Bank Entry Point<br />

MFDSP$ MFDSP$ CBMFDSP$<br />

E–4 7833 1733–004


<strong>SYSLIB</strong> Common Bank Entry Points<br />

Table E–3 lists the routines and entry points for <strong>SYSLIB</strong> common bank <strong>SYSLIB</strong>$3.<br />

Table E–3. <strong>SYSLIB</strong>$3 Entry Points<br />

Element Name Relocatable Entry<br />

Point<br />

FDASC$ ASCFD$ CBASCFD$<br />

FDASC$ CBFDASC$<br />

Common Bank Entry Point<br />

SAR$ATREAD$G SAR$ATR$PG CBSAR$ATR$PG<br />

SAR$INATR$PG CBSAR$INATR$<br />

SAR$RSATR$PG CBSAR$RSATR$<br />

SAR$COM$G SAR$COM$PG CBSAR$COM$PG<br />

SAR$READ$G SAR$CLOSI$PG CBSAR$CLOSI$<br />

SAR$OPENI$PG CBSAR$OPENI$<br />

SAR$READ$PG CBSAR$READ$P<br />

SDFI SDFIC$ CBSDFIC$<br />

SDFINT$ CBSDFINT$<br />

SDFIOA$ CBSDFIOA$<br />

SDFIO$ CBSDFIO$<br />

SDFI$ CBSDFI$<br />

Table E–4 lists the routines and entry points for <strong>SYSLIB</strong> common bank <strong>SYSLIB</strong>$4.<br />

Table E–4. <strong>SYSLIB</strong>$4 Entry Points<br />

Element Name Relocatable Entry Point Common Bank Entry Point<br />

SAR$WRITE$G SAR$CLOSO$PG CBSAR$CLOSO$<br />

SAR$OPENO$PG CBSAR$OPENO$<br />

SAR$WCNTL$PG CBSAR$WCNTL$<br />

SAR$WRITE$PG CBSAR$WRITE$<br />

SDFO SDFOC$ CBSDFOC$<br />

SDFOOSF$ CBSDFOOSF$<br />

SDFOO$ CBSDFOO$<br />

SDFO$ CBSDFO$<br />

7833 1733–004 E–5


<strong>SYSLIB</strong> Common Bank Entry Points<br />

E–6 7833 1733–004


Appendix F<br />

Interface to Selected Extended Mode<br />

Executive Requests<br />

This appendix describes an interface from Extended Mode Object Modules (EMOM) to a<br />

small subset of basic mode Executive requests (ER). The interface allows a MASM<br />

program executing in Extended Mode (as an object module) to perform selected ERs.<br />

The purpose of this interface is to provide the EMOM programmer with a way to dump<br />

data and perform simple symbiont requests. This is a temporary solution only, provided<br />

for the EMOM programmer’s convenience until the Exec callable interfaces are available.<br />

To use this interface, the MASM program uses PROCs to execute ERs. These PROCs<br />

save the contents of all registers they use (including B-registers), jump to a basic mode<br />

<strong>SYSLIB</strong> common bank (<strong>SYSLIB</strong>$1), execute the ER, return to the EMOM, and restore<br />

the contents of registers they use. These PROCs are contained in the omnibus element<br />

EM2CB$P, which must be obtained by the MASM ‘$INCLUDE’ directive. The element<br />

EM2CB$P is contained in the <strong>SYSLIB</strong> product file. No file name is necessary on the<br />

$INCLUDE directive if <strong>SYSLIB</strong> is installed using the default product file name<br />

SYS$LIB$*<strong>SYSLIB</strong>.<br />

This interface requires MASM level 4R2 (or later) and Exec level 40R1 (or later).<br />

F.1. Calling Sequence<br />

The EM to ER interface PROCs in element EM2CB$P call the EM$ERS routine in the<br />

<strong>SYSLIB</strong> common bank. The following ERs may be performed by calling these PROCs:<br />

APRINT$ PRINT$ SNAP$<br />

AREAD$ READ$ TREAD$<br />

ATREAD$<br />

7833 1733–004 F–1


Interface to Selected Extended Mode Executive Requests<br />

Calling Sequence<br />

EM$xxxxx pkt,b-reg<br />

Parameters<br />

xxxxx<br />

pkt<br />

b-reg<br />

The ER mnemonic to be performed; READ, AREAD, PRINT, APRINT, TREAD,<br />

ATREAD, or SNAP.<br />

The label (18-bit offset from zero) of the packet generated by the appropriate<br />

EM$xxxxPKT PROC.<br />

The B-register of the bank containing the packet generated by the appropriate<br />

EM$xxxxPKT PROC.<br />

Each EM$xxxxx PROC call switches to a basic mode bank, performs the ER, and<br />

switches back to the extended mode bank.<br />

F.2. Packet Generation<br />

The PROCs in the following subsections generate the required packets for the Extended<br />

Mode interfaces to ERs.<br />

F.2.1. EM$READPKT<br />

The EM$READPKT PROC generates the packet for the EM$READ and EM$AREAD<br />

PROCs.<br />

Calling Sequence<br />

label EM$READPKT buffer<br />

or<br />

label EM$AREADPKT buffer<br />

Parameters<br />

buffer<br />

The address (18-bit offset from zero) of the buffer into which the image will be read.<br />

The buffer parameter may be set at execution time, and is located at word 2 of the<br />

packet (packet address + 1).<br />

F–2 7833 1733–004


Interface to Selected Extended Mode Executive Requests<br />

The buffer must be either in the same bank that contains the packet or in a bank that is<br />

based on B15 when EM$READ or EM$AREAD is called.<br />

The status word from the ER READ$/AREAD$ is returned in word 3 of the packet<br />

(packet address + 2). S2 of word 3 contains an EOF flag; a nonzero value indicates an<br />

end-of-file condition. S1 of word 3 contains the bit settings returned from the ER<br />

READ$/AREAD$ request (bits 35 to 30). H2 of word 3 contains the number of words<br />

read by EM$READ/EM$AREAD into the buffer. The buffer is not space filled if the<br />

length of the image read is shorter than the length of the buffer.<br />

F.2.2. EM$PRINTPKT<br />

The EM$PRINTPKT PROC generates the packet for the EM$PRINT and EM$APRINT<br />

PROCs.<br />

Calling Sequence<br />

label EM$PRINTPKT buf,len[,linespa]<br />

or<br />

label EM$APRINTPKT buf,len[,linespa]<br />

Parameters<br />

buf<br />

len<br />

linespa<br />

The address (18-bit offset from zero) of the buffer containing the image to be<br />

printed.<br />

The word length of the image to be printed.<br />

The line spacing for the image to be printed (if omitted, the default is one).<br />

The buf, len, and linespa parameters may also be set at execution time. The buf<br />

parameter is located at word 3 of the packet (packet address + 2). The len parameter is<br />

located at S3 of word 2 of the packet, and the linespa parameter is located at T1 of word<br />

2.<br />

The buffer must be in either the same bank that contains the packet or in a bank that is<br />

based on B15 when EM$PRINT or EM$APRINT is called.<br />

7833 1733–004 F–3


Interface to Selected Extended Mode Executive Requests<br />

F.2.3. EM$TREADPKT<br />

The EM$TREADPKT PROC generates the packet for the EM$TREAD and EM$ATREAD<br />

PROCs.<br />

Calling Sequence<br />

label EM$TREADPKT outbuf,len,linespa,inbuf<br />

or<br />

label EM$ATREADPKT outbuf,len,linespa,inbuf<br />

Parameters<br />

outbuf<br />

len<br />

linespa<br />

inbuf<br />

The address (18-bit offset from zero) of the buffer containing the image to be<br />

printed.<br />

The word length of the image to be printed.<br />

The line spacing for the image to be printed (if omitted, the default is one).<br />

The address (18-bit offset from zero) of the buffer to read the input image into.<br />

The outbuf, len, linespa, and inbuf parameters may also be set at execution time.<br />

The outbuf parameter is located at word 3 of the packet (packet address + 2). The len<br />

parameter is located at S3 of word 2 of the packet, and the linespa parameter is located<br />

at T1 of word 2. The inbuf parameter is located at word 4 of the packet.<br />

The buffers must be in either the same bank that contains the packet or in a bank that is<br />

based on B15 when EM$TREAD or EM$ATREAD are called.<br />

The status word from ER TREAD$/ATREAD$ is returned in word 5 (packet address + 4)<br />

of the packet. S2 of word 5 contains an EOF flag; a non-zero value indicates an end-offile<br />

condition. S1 of word 5 contains the bit settings returned from the ER<br />

READ$/AREAD$ request (bits 35 to 30). H2 of word 5 contains the number of words<br />

read by EM$READ/EM$AREAD into the input buffer. The input buffer is not space filled<br />

if the length of the image read is shorter that the length of the input buffer.<br />

F–4 7833 1733–004


F.2.4. EM$SNAPPKT<br />

Interface to Selected Extended Mode Executive Requests<br />

The EM$SNAPPKT PROC generates the packet for the EM$SNAP PROC.<br />

Calling Sequence<br />

label EM$SNAPPKT snap-id,xar,len,address<br />

Parameters<br />

snap-id<br />

xar<br />

len<br />

address<br />

The snapshot identifier, from 1 to 6 characters (in quotes).<br />

The bits identifying which registers to dump (same as for L$SNAP PROC).<br />

The number of words to dump.<br />

The address (18-bit offset from zero) to start dumping words from.<br />

All of the parameters may also be set at execution time. The snap-id parameter is<br />

located at word 2 of the packet (packet address + 1). The xar parameter is located in bits<br />

35 to 33 of word 3 of the packet. The len and address parameters are located in bits 32<br />

to 18 and in H2 of word 3, respectively.<br />

The dump address must be in either the same bank that contains the packet or in a bank<br />

that is based on B15 when EM$SNAP is called.<br />

The value given for address must be greater than the highest address of the <strong>SYSLIB</strong>$1<br />

common bank rounded up to the next highest 01000. The highest address of the<br />

<strong>SYSLIB</strong>$1 common bank is given in Table D–2. This is necessary because common bank<br />

<strong>SYSLIB</strong>$1 is based to perform the ER SNAP$ and any address to be dumped that<br />

overlaps the <strong>SYSLIB</strong>$1 address limits will give incorrect results.<br />

7833 1733–004 F–5


Interface to Selected Extended Mode Executive Requests<br />

F.3. Example<br />

The following example uses the EM$APRINT PROC to print a line of ASCII characters<br />

from an EMOM:<br />

$ASCII<br />

$EXTEND<br />

$OBJ<br />

$INCLUDE ‘MAXR$’<br />

$INCLUDE ‘OM$DEF’<br />

$INCLUDE ‘EM2CB$P’<br />

.<br />

OM$USE_LV LVBANK,,B2<br />

.<br />

$(0) $BANK OM$DATA_EMB,050000 ‘DBA . EM data bank<br />

DSTART<br />

APRTPKT EM$APRINTPKT APRTBUF,APRTBUFL . Packet<br />

APRTBUF ‘Print an ASCII line.’ . ASCII image to print<br />

APRTBUFL $EQU $-APRTBUF . Word length<br />

.<br />

$(1) $BANK OM$CODE_EMB,01000 ‘IBANK’ . EM code bank<br />

START$*<br />

LBU B2,R0 . Load Link Vector<br />

bank<br />

. virtual address into<br />

B2<br />

OM$LOAD_BDR B3,DSTART,,B2 . Base data bank on B3<br />

.<br />

EM$APRINT APRTPKT,B3 . Print ASCII start<br />

line<br />

.<br />

RTN . Program completed<br />

$END<br />

In this example, the EM$APRINTPKT PROC generates the packet for the EM$APRINT<br />

PROC. The ASCII line to be printed is at label APRTBUF. The data bank containing the<br />

image and the packet is based on B3. The EM$APRINT PROC performs the ER<br />

APRINT$.<br />

F–6 7833 1733–004


Appendix G<br />

INFOR Information<br />

When a program is executed as a processor, the OS 2200 Exec converts the processor<br />

call statement into internal format (INFOR) and supplies it as input data to the first<br />

symbiont read operation performed by the program.<br />

Note: This conversion occurs only for programs that are executed as a processor<br />

(@program) and not for programs executed with the @XQT control statement (@XQT<br />

program).<br />

G.1. INFOR Identifiers for Processor Call Statement<br />

The following diagram shows the general format of a processor call statement and the<br />

parts that are identified by INFOR.<br />

INFOR identifies the processor,options part of the processor call statement as field type<br />

0. This is referred to as the command field. It is composed of field 1 and the option<br />

field. The field?1, field?2, ...,field?n part of the call statement is identified as field type 1<br />

and is referred to as the specification field. It is composed of a variable number of<br />

fields. INFOR does not include the label field and comment field of the processor call<br />

statement.<br />

Note: In other Unisys documents, the command field may be referred to as the<br />

processor field or operation field. The specification field may be referred to as the<br />

operand field, parameter operand, or parameter field.<br />

7833 1733–004 G–1


INFOR Information<br />

A field in the processor call statement contains information that conforms to the syntax<br />

conventions of a file name or element name, as specified in the Executive Control<br />

Language (ECL) and FURPUR <strong>Reference</strong> <strong>Manual</strong>. The format of the standard<br />

filename.eltname notation consists of 8 parts. The following diagram shows how these<br />

parts are identified by INFOR.<br />

INFOR identifies each part of the filename.eltname in a field by its assigned subfield<br />

number. For example, the filename is always identified as subfield number 2, and<br />

eltname is always identified as subfield number 6. The character data contained within<br />

the subfield is referred to as the symbolic subfield.<br />

G–2 7833 1733–004


G.2. The INFOR Table<br />

The format of the INFOR table is as follows:<br />

INFOR Information<br />

7833 1733–004 G–3


INFOR Information<br />

Word 0<br />

Bits 0–9<br />

Type<br />

Control statement type number. If these 10 bits are placed right-justified and<br />

zero-filled in a 36-bit word, the result value indicates the following:<br />

0051 The INFOR table is for a processor call.<br />

0100 The INFOR table is for a FURPUR statement.<br />

Note: In an octal dump of word 0, the 4 leftmost octal digits would be 0244 if the<br />

INFOR table is for a processor call and the A and B options were not<br />

specified.<br />

Bits 10–35<br />

Options<br />

These 26 bits are master bits representing the options that were specified in the<br />

option field of the processor call statement. Bit 10 is set if A was specified, bit<br />

11 is set if B was specified, ..., bit 35 is set if Z was specified.<br />

Note: The option field has no field number associated with it and has no subfield<br />

descriptions generated for it.<br />

Subfield Description<br />

This is an entry of 2 or 3 words consisting of the following parts:<br />

• Subfield control word<br />

• Symbolic subfield<br />

There is one subfield description for each subfield that was specified in the processor<br />

call statement.<br />

G–4 7833 1733–004


Subfield Control Word<br />

The following 1-word entry provides information about the subfield.<br />

Bits 0–5<br />

Field Type (FT)<br />

Bits 6–11<br />

INFOR Information<br />

Indicates whether the subfield is in the command field or in the specification<br />

field. The possible values are<br />

0 Command field<br />

1 Specification field<br />

Field Number (FN)<br />

Bits 12–17<br />

The field number (within the field type) that contains the subfield. In the<br />

processor call statement, fields are numbered beginning with 1, left to right, and<br />

are separated by commas. The highest field number is 63. If more than 63<br />

fields are entered in the processor call statement, the 64th and following fields<br />

are numbered beginning with 1.<br />

Subfield Number (SFN)<br />

Identifies which part of the filename.eltname notation is being described by the<br />

subfield. The possible values are<br />

1 File qualifier<br />

2 File name<br />

3 File cycle<br />

4 Read key<br />

5 Write key<br />

6 Element name<br />

7 Version name<br />

8 Element cycle<br />

7833 1733–004 G–5


INFOR Information<br />

Bits 18–23<br />

File Continuation Indicator (FCI)<br />

Bits 24–29<br />

The possible values are<br />

075 The Fieldata code for the period (.) character. This value indicates that<br />

the subfield is the first one of the field, and the field contains a leading<br />

period.<br />

000 Value used for all other cases.<br />

Character Count (CC)<br />

Bits 30–35<br />

A value in the range 1 to 6. The character count indicates the number of<br />

characters in the last word of the symbolic subfield.<br />

Word Count (WC)<br />

A value of 1 or 2. The word count indicates the number of words in the<br />

symbolic subfield of the subfield description.<br />

Symbolic Subfield<br />

This is the character data that was entered for the subfield in the processor call<br />

statement. It is a Fieldata character string that uses either 1 or 2 words as indicated by<br />

the WC value. Each word can contain up to 6 characters. The number of characters in<br />

the symbolic subfield can be calculated using the following formula:<br />

6 * (WC - 1) + CC<br />

The characters are left-justified, and the unused rightmost character positions in the last<br />

word are space-filled.<br />

G–6 7833 1733–004


INFOR Information<br />

The range for number of characters and number of words in the symbolic subfield is as<br />

follows:<br />

SFN Subfield Name Number of Characters Number of Words<br />

1 File qualifier 1 to 12 1 or 2<br />

2 File name 1 to 12 1 or 2<br />

3 File cycle 1 to 3 1<br />

4 Read key 1 to 6 1<br />

5 Write key 1 to 6 1<br />

6 Element name 1 to 12 1 or 2<br />

7 Version name 1 to 12 1 or 2<br />

8 Element cycle 1 to 3 1<br />

G.3. INFOR Table Conventions<br />

The following conventions are used when generating the INFOR data:<br />

• Except for one special situation, a subfield description is generated only if symbolic<br />

subfield information has been entered for that subfield number in the processor call<br />

statement. The exception is if a field in the processor call statement contains a file<br />

name with a leading asterisk (*) character. For this situation, a subfield description is<br />

generated as if a qualifier of 12 spaces had been entered in that field in the<br />

processor call statement.<br />

• If a field in the processor call statement contains a leading period, the first subfield<br />

description generated for the field will contain a value of 075 in the FCI part of the<br />

subfield control word.<br />

• If the symbolic information in the processor call statement uses a character type<br />

other than Fieldata, it is first translated into Fieldata before being put in the INFOR<br />

table. For example, if lowercase ASCII characters are entered in the processor call<br />

statement, the symbolic subfields in the INFOR table will contain the corresponding<br />

uppercase characters in Fieldata.<br />

• If a processor call statement is continued onto more than one line using the<br />

semicolon (;), the INFOR is generated as if the call statement were on one line.<br />

7833 1733–004 G–7


INFOR Information<br />

G.4. INFOR Table Example<br />

Assume that the following processor call statement is entered to execute program.abs<br />

with c and z options and 3 fields in the specification field.<br />

The following octal word would be generated for word 0 of INFOR:<br />

024440000001<br />

The following subfield descriptions would be generated in the INFOR table:<br />

Field 1 of command field<br />

FT FN SFN FCI CC WC Symbolic Subfield<br />

00 01 02 00 01 02 PROGRAM∆∆∆∆∆<br />

00 01 06 00 03 01 ABS∆∆∆<br />

Field 1 of specification field<br />

FT FN SFN FCI CC WC Symbolic Subfield<br />

01 01 01 00 06 02 ∆∆∆∆∆∆∆∆∆∆∆∆<br />

01 01 02 00 05 01 FILE1∆<br />

01 01 05 00 06 01 WRTKEY<br />

01 01 06 00 04 01 ELT1∆∆<br />

01 01 010 00 01 01 1∆∆∆∆∆<br />

Field 2 of specification field<br />

No subfield descriptions are generated because the field contains only subfield<br />

separators and no symbolic subfield information.<br />

Field 3 of specification field generates 23 words of INFOR<br />

FT FN SFN FCI CC WC Symbolic Subfield<br />

01 03 06 075 06 02 ELEMENTNAME3<br />

01 03 07 00 02 02 VERSION3∆∆∆∆<br />

G–8 7833 1733–004


G.5. Reading the INFOR Table<br />

INFOR Information<br />

The INFOR data is supplied as input data to the first symbiont read operation performed<br />

by the program. The program issues an ER AREAD$, ER READ$, or ER SYMB$<br />

(READ$ function) with a buffer size of at least 27 words specified. The INFOR data is<br />

received in blocks of 27 words or less. Only full subfield descriptions are put in the<br />

block. If a subfield description does not fit within the last words of the block, it is put in<br />

the next block.<br />

Upon return from the read, register A0 contains the following information:<br />

Bit 4 This bit is set if the data transferred into the buffer is INFOR data.<br />

Bit 5 This bit is set if more INFOR data needs to be read.<br />

Bits 18–35 These bits specify the number of words transferred into the buffer.<br />

Notes:<br />

• If the program issues a read command that specifies a buffer size less than 27<br />

words, INFOR data may be transferred into the area beyond the end of the buffer.<br />

• The <strong>SYSLIB</strong> and the SLIB service libraries provide INFOR routines to read the INFOR<br />

table, to search it, and to transfer data from it to other tables. See the SLIB<br />

<strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong>.<br />

G.6. Determining the INFOR Table Size<br />

If a program intends to read the entire INFOR table into memory, the size of the memory<br />

area needed to hold the INFOR table can be determined by adding the maximum sizes<br />

needed by the various types of information that are put in the table.<br />

1 Word 0 of INFOR table<br />

+ 18 Words needed for field 1 of the command field if it contains a<br />

fully specified file name and element name.<br />

+ 20*n<br />

————<br />

sum<br />

n is the number of fields that the program expects in the<br />

specification field. Multiply n by 20, which is the number of<br />

words needed by each field if it contains a fully specified file<br />

name and element name.<br />

The sum above is the maximum size of the INFOR table.<br />

7833 1733–004 G–9


INFOR Information<br />

G–10 7833 1733–004


Appendix H<br />

ASCII-like Character Sets<br />

Table H–1 indicates which character sets are ASCII-like. ASCII-like character sets are<br />

those that are essentially identical to the ASCII/ISO character set in the range of values<br />

from 0000 to 0177. Where ASCII-like character sets differ from ASCII/ISO in the 0000<br />

through 0177 range, the difference must be minor. For example, a character set that<br />

replaces the U.S. dollar sign with a British pound sign is ASCII-like because both are<br />

currency symbols.<br />

Table H–1. Character Set Types<br />

Name Octal Code Character Set Description ASCII-like<br />

Fieldata 000 Fieldata character set<br />

ASCII_ISO 001 ASCII/ISO character set. The data is expected<br />

to be in the United States variant of ISO 646.<br />

Historically, however, this value has also been<br />

used to indicate any quarter-word character<br />

set (in contrast to sixth-word Fieldata).<br />

ASCII_APL 002 ASCII/APL character set Yes<br />

EBCDIC 003 Extended Binary Coded Decimal Interchange<br />

Code (EBCDIC)<br />

Binary 004 Raw binary<br />

Untyped 005 Untyped data, or application-dependent data<br />

Column_Binary 006 Column binary format character set<br />

OIAP 007 Reserved for use by the operating system.<br />

Customer_Reserved 010-015 Reserved for customer use. These characters<br />

are assumed to be ASCII-like.<br />

Hangul 016 Hangul character set<br />

Hanzi 017 Hanzi character set<br />

Kanji 020 JIS-16 18-bit kanji format character set<br />

ISO_646_US 021 United States variant of ISO 646 Yes<br />

ISO_646_Nor_Den 022 Norway/Denmark variant of ISO 646 Yes<br />

ISO_646_France 023 French variant of ISO 646 Yes<br />

ISO_646_Germany 024 German variant of ISO 646 Yes<br />

ISO_646_UK 025 United Kingdom variant of ISO 646 Yes<br />

7833 1733–004 H–1<br />

Yes<br />

Yes


ASCII-like Character Sets<br />

Table H–1. Character Set Types<br />

Name Octal Code Character Set Description ASCII-like<br />

ISO_646_Italy 026 Italian variant of ISO 646 Yes<br />

ISO_646_Spain 027 Spanish variant of ISO 646 Yes<br />

ISO_646_Sweden 030 Swedish variant of ISO 646 Yes<br />

ISO_646_Finland 031 Finnish variant of ISO 646 Yes<br />

ISO_646_Canada 032 Canadian variant of ISO 646 Yes<br />

ISO_646_Netherlands 033 Netherlands variant of ISO 646 Yes<br />

ISO_646_Portugal 034 Portuguese variant of ISO 646 Yes<br />

ISO_Reserved 035-040 Reserved for future definition of ISO character<br />

sets.<br />

Customer_Reserved 041-042 Reserved for customer use. These character<br />

sets can be defined in any way required by the<br />

customer, but ECL commands cannot be<br />

entered using them. They are treated as not<br />

ASCII-like.<br />

ISO_8859_1 043 ISO 8859.1 character set (Latin 1) Yes<br />

ISO_8859_2 044 ISO 8859.2 character set (Latin 2) Yes<br />

ISO_8859_3 045 ISO 8859.3 character set (Latin 3) Yes<br />

ISO_8859_4 046 ISO 8859.4 character set (Latin 4) Yes<br />

ISO_8859_5 047 ISO 8859.5 character set (Latin/Cyrillic) Yes<br />

ISO_8859_6 050 ISO 8859.6 character set (Latin/Arabic) Yes<br />

ISO_8859_7 051 ISO 8859.7 character set (Latin/Greek) Yes<br />

ISO_8859_8 052 ISO 8859.8 character set (Latin/Hebrew) Yes<br />

ISO_8859_9 053 ISO 8859.9 character set (Latin 5) Yes<br />

ISO_8859_10 054 ISO 8859.10 character set (box drawing set) Yes<br />

French_Arabic 055 French/Arabic character set Yes<br />

Japan_ISO_3 056 Katakana character set Yes<br />

BICS 057 BICS character set Yes<br />

ISO_Reserved 060-062 Reserved for a future definition of ISO<br />

character sets.<br />

General_Reserved 063-075 Reserved for arbitrary future use. Assumed to<br />

be not ASCII-like.<br />

H–2 7833 1733–004<br />

Yes<br />

Yes


Table H–1. Character Set Types<br />

ASCII-like Character Sets<br />

Name Octal Code Character Set Description ASCII-like<br />

Alternate_Location 076 Reserved for future use. This code indicates<br />

that the user must look in an alternate location<br />

for the actual code type.<br />

This code is not supported; its use results in<br />

an error.<br />

ACD 077 Attributed character data (ACD) format<br />

character set.<br />

7833 1733–004 H–3


ASCII-like Character Sets<br />

H–4 7833 1733–004


Appendix I<br />

Extended Mode Interface to <strong>SYSLIB</strong><br />

I.1. General<br />

Some <strong>SYSLIB</strong> routines can be called from Extended Mode Object Modules (EMOM)<br />

written in MASM. This is accomplished by interfacing from extended mode banks to the<br />

<strong>SYSLIB</strong> basic mode common banks. This appendix describes how to use the interface.<br />

For complete information on how to use each routine, see the corresponding sections in<br />

this manual.<br />

The following <strong>SYSLIB</strong> routines may be called from EMOMs with this interface:<br />

• AEDIT$ package<br />

• BSP$<br />

• FDASC$<br />

• GETPSF$<br />

• ID$<br />

• INFOR$<br />

• MFDSP$<br />

Each <strong>SYSLIB</strong> routine has a MASM PROC defined to call it, and a MASM PROC defined<br />

to generate a packet for the call. These PROCs are contained in the omnibus element<br />

EM2CB$P, which must be obtained by the MASM ‘$INCLUDE’ directive. The element<br />

EM2CB$P is contained in the <strong>SYSLIB</strong> product file. No file name is necessary on the<br />

$INCLUDE directive if <strong>SYSLIB</strong> is installed using the default product file name<br />

SYS$LIB$*<strong>SYSLIB</strong>.<br />

This interface requires MASM level 4R2 (or higher) and Exec level 40R1 (or higher).<br />

7833 1733–004 I–1


Extended Mode Interface to <strong>SYSLIB</strong><br />

I.2. Interface to the AEDIT$ Package<br />

All of the routines in the AEDIT$ package are called with the EM$EDIT PROC. The<br />

packet for the AEDIT$ package is generated with the EM$EDITPKT PROC.<br />

The EM$EDIT PROC calls the ASCII editing routines in the <strong>SYSLIB</strong> common bank.<br />

Calling Sequence:<br />

EM$EDIT pkt,b-reg [func,param1,param2]<br />

where:<br />

pkt<br />

b-reg<br />

func<br />

The label (18-bit offset from zero) of the packet generated by the EM$EDITPKT<br />

PROC.<br />

The B-register describing the bank containing the packet generated by the<br />

EM$EDITPKT PROC.<br />

The code for which ASCII editing function to perform. See Table I–1 for a list of all<br />

function codes.<br />

param1<br />

The first additional parameter for the EM$EDIT call. This parameter varies<br />

depending on which function code is used. See Table I–2 for a list of first parameter<br />

values.<br />

param2<br />

The second additional parameter for the EM$EDIT call. This parameter varies<br />

depending on which function code is used. See Table I–3 for a list of second<br />

parameter values.<br />

The func, param1, param2 parameters are optional. If they are omitted, EM$EDIT uses<br />

the values contained in registers A1, A2, and A3, respectively. Since the EM$EDIT<br />

PROC does not handle all combinations, either supply all parameters or all registers.<br />

I–2 7833 1733–004


Extended Mode Interface to <strong>SYSLIB</strong><br />

Table I–1 contains the function codes which may be used on the EM$EDIT PROC call.<br />

Table I–1. EM$EDIT Function Codes<br />

Code Description<br />

1 Initialize and enter edit mode.<br />

2 Reenter edit mode without initializing.<br />

3 Terminate edit mode.<br />

4 Print image and terminate edit mode.<br />

5 Insert a character into the image buffer.<br />

6 Clear the image buffer.<br />

7 Move to a column position.<br />

8 Return the current column position.<br />

9 Copy a string into the image buffer.<br />

10 Edit a decimal number with leading zeroes.<br />

11 Edit a decimal number with leading spaces.<br />

12 Edit a decimal number with variable length.<br />

13 Insert one word of ASCII characters into the image buffer.<br />

14 Insert two words of ASCII characters into the image buffer.<br />

15 Begin copying a message to the image buffer.<br />

16 Resume copying a message to the image buffer.<br />

17 Edit an octal number with fixed length.<br />

18 Edit an octal number with variable length.<br />

19 Copy a string to the image buffer but exclude any null characters.<br />

20 Move the column pointer forward.<br />

21 Edit a floating-point number to single-precision fixed-length decimal format.<br />

22 Edit a floating-point number to double-precision fixed-length decimal format.<br />

23 Edit a floating-point number to single-precision generalized format.<br />

24 Edit a floating-point number to double-precision generalized format.<br />

25 Edit a floating-point number to single-precision scientific format.<br />

26 Edit a floating-point number to double-precision scientific format.<br />

27 Place a standard format date and time string in the image buffer.<br />

If the first parameter is an address, it must be in the same bank as the packet generated<br />

by the EM$EDITPK PROC. All addresses are an 18-bit offset from zero.<br />

7833 1733–004 I–3


Extended Mode Interface to <strong>SYSLIB</strong><br />

Table I–2 contains the possible values for the first parameter field. Function codes not<br />

listed in the table do not require a first parameter value.<br />

Table I–2. EM$EDIT First Parameter Field Values<br />

Code Description<br />

4 The line spacing for printing the image<br />

5 The ASCII character to be inserted<br />

7 The column number to move to<br />

9 The address of the string to copy<br />

10, 11, 12 The address of the integer to edit<br />

13, 14 The address of the ASCII characters<br />

15 The address of the string to copy<br />

17, 18 The address of the integer to edit<br />

19 The address of the string to copy<br />

20 The number of columns to move forward<br />

21–26 The address of the floating point number<br />

Table I–3 contains the possible values for the second parameter field. Function codes<br />

not listed in the table do not require a second parameter value.<br />

Table I–3. EM$EDIT Second Parameter Field Values<br />

Code Description<br />

9 The number of characters to copy<br />

10, 11, 17 The length of the field in characters<br />

19 The number of characters to copy<br />

21–26<br />

The field length specification in the format x * /6 + y<br />

where x is the field length in characters and y is the<br />

number of digits following the decimal point<br />

There are no parameters for function code 27. To edit the current date or time, set the<br />

DATE and TIME fields in the packet generated by EM$EDITPKT to zero (default). To edit<br />

a specified date or time, set these fields to the desired TDATE$ or TIME$ values. The<br />

DATE field is word 17 of the packet (packet address + 16), and the TIME field is word 18<br />

of the packet (packet address + 17).<br />

I–4 7833 1733–004


Extended Mode Interface to <strong>SYSLIB</strong><br />

EM$EDIT returns the status of the call to AEDIT$ routines in the packet field CALLSTAT.<br />

The CALLSTAT field is S3 of word 2 of the packet (packet address + 1). The possible<br />

status are:<br />

0 Normal return from the AEDIT$ routine<br />

1 Error return from AEDIT$ (for function code 27 only)<br />

2 Illegal value given for the AEDIT$ function code<br />

EM$EDIT constructs the ASCII image in a buffer contained in the packet generated by<br />

EM$EDITPKT. The address of the first word of the buffer is identified by the<br />

externalized label EM$EDITBUF. The value of EM$EDITBUF is the offset from zero to<br />

the start of the buffer.<br />

Packet Generation<br />

The EM$EDITPKT PROC generates the packet for the Extended Mode interface to the<br />

AEDIT$ routines. This packet is required by the EM$EDIT PROC.<br />

Calling Sequence:<br />

label EM$EDITPKT buflen ['MSG', msg][ 'FPS', fps] :<br />

['FPR', fpr] ['DPC',dpc] ['SPC', spc] :<br />

['DFT', dft] ['TFT',tft] ['SEP', sep]<br />

where:<br />

buflen<br />

The length in words of the data area used to contain the image constructed by<br />

AEDIT$ This buffer is part of the EM$EDITPKT, and the address of the first word is<br />

identified by the label EM$EDITBUF.<br />

msg, fps, fpr, dpc, spc, dft, tft, sep<br />

Optional parameters, as defined in Section 4.<br />

I.3. Interface to BSP$<br />

All of the functions of the BSP$ routine are called with the EM$BSP PROC. The packet<br />

for BSP$ is generated with the EM$BSPPKT PROC.<br />

Calling Sequence:<br />

EM$BSP pkt, b-reg [func,param1,param2]<br />

where:<br />

pkt<br />

The label (18-bit offset from zero) of the packet generated by the EM$BSPPKT<br />

PROC.<br />

7833 1733–004 I–5


Extended Mode Interface to <strong>SYSLIB</strong><br />

b-reg<br />

func<br />

The B-register of the bank containing the packet generated by the EM$BSPPKT<br />

PROC.<br />

The code for which BSP$ function to perform. See Table I–4 for a list of all function<br />

codes.<br />

param1, param2<br />

Additional parameter for some function codes. See Table I–5 for a list of parameter<br />

values. Functions 2 through 6 require one additional parameter. Functions 10 and<br />

11 require two additional parameters.<br />

The func, param1, and param2 parameters are optional. If func is omitted or specified as<br />

0, EM$BSP uses the value contained in register A1.<br />

If the function requires one parameter:<br />

• If param1 is omitted or specified as 0, EM$BSP uses the value contained in register<br />

A2.<br />

• param2 should be omitted.<br />

If the function requires two parameters:<br />

• If param1 is omitted or specified as 0, EM$BSP uses the value contained in register<br />

A2 modifier (bits 18–35).<br />

• If param1 is specified, even as 0, param2 should also be specified.<br />

• If param2 is omitted or specified as 0, EM$BSP uses the value contained in register<br />

A2 increment (bits 0–17).<br />

I–6 7833 1733–004


Extended Mode Interface to <strong>SYSLIB</strong><br />

Table I–4 contains the function codes that may be used on the EM$BSP PROC call.<br />

Table I–4. EM$BSP Function Codes<br />

Code Description<br />

1 Read the file table index (RFTI$).<br />

2 Read a program file table.<br />

3 Search the program file table for an item.<br />

4 Add an item to the program file table.<br />

5 Delete an item from the program file table.<br />

6 Locate an item by its sequence number.<br />

7 Write out the last item referenced.<br />

8 Write out the program file table.<br />

9 Write the file table index back.<br />

10 Change an item in the program file table.<br />

11 Read the file table index (RFTI$$).<br />

12 Mark the last item referenced as updated.<br />

Table I–5 contains the possible values for the parameter field. Function codes not listed<br />

in the table do not require a parameter value.<br />

Table I–5. EM$BSP Parameter Field Values<br />

Code Description<br />

2 The code for which program file table to read:<br />

1 Element table<br />

2 Assembler procedure table<br />

3 COBOL procedure table<br />

4 FORTRAN/PLUS procedure table<br />

5 Entry point table<br />

3 The address of the search packet.<br />

4 The address of the add packet.<br />

5 The address of the delete packet.<br />

6 The sequence number of the item to locate.<br />

10 Param1 is the address of the search packet. Param2 is<br />

the address of the change packet.<br />

11 Param1 is the BSP$ interface level. Param2 is the<br />

program file format for an empty file.<br />

7833 1733–004 I–7


Extended Mode Interface to <strong>SYSLIB</strong><br />

If the parameter is an address, it must be in the same bank as the packet generated by<br />

the EM$BSPPKT PROC. All addresses are an 18-bit offset from zero.<br />

The buffer for file table index (FTI) is contained in the packet generated by the<br />

EM$BSPPKT PROC. The first word of the FTI is identified by the externalized label<br />

EM$FTI. The value of EM$FTI is the offset from zero to the start of the FTI.<br />

EM$BSP returns the status of the call to BSP$ in the packet field CALLSTAT. The<br />

CALLSTAT field is S3 of word 2 of the packet (packet address + 1). The possible status<br />

is<br />

0 Normal return from BSP$<br />

1 Error return from BSP$, error code in field A0SAVE<br />

2 Illegal value given for the BSP$ function code<br />

3 Illegal value given for the table type (TBLTYPE field)<br />

For CALLSTAT codes 0 and 1, the contents of registers A0, A1, and A2 from BSP$ are<br />

returned in packet fields A0SAVE, A1SAVE, and A2SAVE, respectively. These fields are<br />

at words 3, 4, and 5 of the packet.<br />

Packet Generation<br />

The EM$BSPPKT PROC generates the packet for the Extended Mode interface to BSP$.<br />

This packet is required for the EM$BSP PROC.<br />

Calling Sequence:<br />

label EM$BSPPKT buflen [,filename]<br />

where:<br />

buflen<br />

The word length of the buffer used to hold the program file table. The length should<br />

be 28*(5+4n), where n is a positive integer. The minimum length is 252 words. For<br />

maximum efficiency, the buffer length should be large enough to contain the entire<br />

table, including the size of entries to be added.<br />

filename<br />

The12-Fieldata-character internal file name of the file to be accessed (in quotes).<br />

This parameter is optional; if omitted, the caller must place the internal file name at<br />

location EM$FTI (an externalized label from this PROC).<br />

The packet generated by the EM$BSPPKT PROC contains the buffers for the FTI and the<br />

program file tables. It is not necessary to allocate additional space for them.<br />

I–8 7833 1733–004


I.4. Interface to FDASC$<br />

Extended Mode Interface to <strong>SYSLIB</strong><br />

The FDASC$ routine is called with the EM$FDASC PROC. The packet for the FDASC$<br />

routine is generated with the EM$FDASCPKT PROC.<br />

The EM$FDASC PROC calls the FDASC$ routine in the <strong>SYSLIB</strong> common bank.<br />

Calling Sequence:<br />

EM$FDASC pkt,b-reg [func]<br />

where:<br />

pkt<br />

b-reg<br />

func<br />

The label (18-bit offset from zero) of the packet gnerated by the EM$FDASCPKT<br />

PROC.<br />

The b-register of the bank containing the packet generated by the EM$FDASCPKT<br />

PROC.<br />

The code for which FDASC$ function to perform:<br />

1 Convert a Fieldata image to ASCII<br />

2 Convert an ASCII image to FIeldata<br />

The func parameter is optional. If it is omitted, EM$FDASC uses the value contained in<br />

register A1.<br />

EM$FDASC performs character set translation on Fieldata and ASCII images. The caller<br />

must place the image to be transferred in the input buffer, and EM$FDASC returns the<br />

translated image in the output buffer. The input and output buffers must be specified in<br />

the packet generated by the EM$FDASCPKT PROC.<br />

EM$FDASC returns the status of the call to FDASC$ in the packet field CALLSTAT. The<br />

CALLSTAT field is S3 of word 2 of the packet (packet address + 1). The possible status<br />

is<br />

0 Normal return from FDASC$<br />

1 Illegal value given for the FDASC$ function code<br />

If the normal return is taken, EM$FDASC returns the word length of the converted<br />

image in H2 of word 3 of the packet (packet address + 2).<br />

7833 1733–004 I–9


Extended Mode Interface to <strong>SYSLIB</strong><br />

Packet Generation<br />

The EM$FDASCPKT PROC generates the packet for the Extended Mode interface to<br />

FDASC$. This packet is required for the EM$%FDASC PROC.<br />

Calling Sequence:<br />

label EM$FDASCPKT len,inbuf,outbuf<br />

where:<br />

len<br />

inbuf<br />

outbuf<br />

The word length of the input buffer.<br />

The label (18-bit offset from zero) of the input buffer.<br />

The label (18-bit offset from zero) of the output buffer.<br />

The input buffer and output buffer must be in the same bank as the packet generated by<br />

the EM$FDASCPKT PROC.<br />

I.5. Interface to GETPSF$<br />

The GETPSF$ routine is called with the EM$GETPSF PROC. The packet for the<br />

GETPSF$ routine is generated with the EM$GETPSFPKT PROC.<br />

Calling Sequence<br />

EM$GETPSF pkt,b-reg [func,param]<br />

where:<br />

pkt<br />

b-reg<br />

The label (18-bit offset from zero) of the packet generated by the EM$GETPSFPKT<br />

PROC.<br />

The B-register of the bank containing the packet generated by the EM$GETPSFPKT<br />

PROC.<br />

I–10 7833 1733–004


func<br />

param<br />

The code for which GETPSF$ function to perform:<br />

1 Assign n program scratch files<br />

2 Assign a specific program scratch file<br />

An additional parameter for the following function codes:<br />

1 The number of files requested (from 1 to 10)<br />

2 The number of the specific file requested<br />

Extended Mode Interface to <strong>SYSLIB</strong><br />

The func and param parameters are optional. If they are omitted, EM$GETPSF uses the<br />

values contained in registers A1 and A2, respectively.<br />

EM$GETPSF returns the status of the call to GETPSF$ in the packet field CALLSTAT.<br />

The CALLSTAT field is S3 of word 2 of the packet (packet address + 1). The possible<br />

status is<br />

0 Normal return from GETPSF$<br />

1 Error return from GETPSF$, error code in field A0SAVE<br />

2 Illegal value given for the GETPSF$ function code<br />

For CALLSTAT codes 0 and 1, the contents of registers A0, A1, and A2 from GETPSF$<br />

are returned in packet fields A0SAVE, A1SAVE, and A2SAVE, respectively. These fields<br />

are at words 3, 4, and 5 of the packet.<br />

Packet Generation<br />

EM$GETPSFPKT generates the 18-word packet for the Extended Mode interface to<br />

GETPSF$. This packet is required for the EM$GETPSF PROC.<br />

Calling Sequence<br />

label EM$GETPSFPKT<br />

There are no parameters for the EM$GETPSFPKT PROC.<br />

7833 1733–004 I–11


Extended Mode Interface to <strong>SYSLIB</strong><br />

I.6. Interface to ID$<br />

The ID$ routine is called with the EM$ID PROC. The packet for the ID$ routine is<br />

generated with the EM$IDPKT PROC.<br />

EM$ID$ calls the ID$ routine in the <strong>SYSLIB</strong> common bank.<br />

Calling Sequence:<br />

EM$ID pkt,b-reg<br />

where:<br />

pkt<br />

b-reg<br />

The label (18-bit offset from zero) of the packet generated by the EM$IDPKT PROC.<br />

The B-register of the bank containing the packet generated by the EM$IDPKT PROC.<br />

This must be the beginning of the bank that contains the packet (in other words, no<br />

subsetting).<br />

Packet Generation:<br />

The EM$IDPKT PROC generates the packet for the Extended Mode interface to ID$.<br />

This packet is required by the EM$ID PROC.<br />

Calling Sequence:<br />

If idbuf or hdrbuf are used, they must be in the same bank as the packet.<br />

I–12 7833 1733–004


I.7. Interface to INFOR$<br />

Extended Mode Interface to <strong>SYSLIB</strong><br />

The INFOR$ routine is called with the EM$INFOR PROC. The packet for the INFOR$<br />

routine is generated with the EM$INFORPKT PROC.<br />

The EM$INFOR PROC calls the INFOR$ routine in the <strong>SYSLIB</strong> common bank.<br />

Calling Sequence:<br />

EM$INFOR pkt,b-reg [func,param]<br />

where:<br />

pkt<br />

b-reg<br />

func<br />

param<br />

The label (18-bit offset from zero) of the packet generated by the EM$INFORPKT<br />

PROC.<br />

The B-register of the bank containing the packet generated by the EM$INFORPKT<br />

PROC.<br />

The code for which INFOR$ function to perform. See Table I–6 for a list of possible<br />

function codes.<br />

An additional parameter for some function codes. See Table I–7 for a list of possible<br />

parameter values.<br />

The func and param parameters are optional; if they are omitted, EM$INFOR uses the<br />

values contained in registers A1 and A2 (and A3 for function code 4), respectively.<br />

Table I–6 contains the function codes that may be used in the EM$INFOR PROC call.<br />

Table I–6. EM$INFOR Function Codes<br />

Code Description<br />

1 Read the INFOR table (RINF$).<br />

2 Search INFOR for a specification subfield (SINF$).<br />

3 Transfer a field to the ELT$ table (SELT$).<br />

4 Dynamically attach a use name to a file (DUSE$).<br />

7833 1733–004 I–13


Extended Mode Interface to <strong>SYSLIB</strong><br />

Table I–7 contains the possible values for the additional parameter field. Function codes<br />

not listed in the table do not require an additional parameter value.<br />

Table I–7. EM$INFOR Additional Parameter Field<br />

Values<br />

Code Description<br />

2 The specification field in the format ftfuss, where:<br />

ft field type<br />

fn field number<br />

ss subfield number<br />

3 The subfield notation in the format ftfu, where:<br />

ft field type<br />

fn field number<br />

4 The use name to attach to the file (1 to 12 Fieldata<br />

characters in quotes)<br />

EM$INFOR returns the status of the call to INFOR$ in the packet field CALLSTAT.<br />

The CALLSTAT field is S3 of word 2 of the packet (packet address + 1). The possible<br />

status is<br />

0 Normal return from INFOR$<br />

1 Error return from INFOR$, error code in field A1SAVE<br />

2 Illegal value given for the INFOR$ function code<br />

The contents of registers A0, A1, A2, and A3 from INFOR$ are returned in packet fields<br />

A0SAVE, A1SAVE, A2SAVE, and A3SAVE, respectively. These fields are at words 3, 4,<br />

5, and 6 of the packet.<br />

Packet Generation:<br />

The EM$INFORPKT PROC generates the packet for the Extended Mode interface to<br />

INFOR$. This packet is required by the EM$INFOR PROC. EM$INFORPKT also<br />

generates the externalized labels INFOR$, FILE$, and ELT$. The value of each label is<br />

the offset from zero to the first word of the data entity.<br />

Calling Sequence:<br />

label EM$INFORPKT tbllen<br />

where tbllen is the word length of the INFOR table; the minimum size is 28 words.<br />

I–14 7833 1733–004


Extended Mode Interface to <strong>SYSLIB</strong><br />

The buffer to hold the INFOR table is contained within the packet generated by the<br />

EM$INFORPKT PROC. The first word of the INFOR table is identified by the<br />

externalized label EM$INFORTBL. The value of this label is offset from zero to the start<br />

of the table.<br />

The caller must set the INFOR$ word to zero for the INFOR$ routine to read the INFOR<br />

table.<br />

I.8. Interface to MFDSP$<br />

All functions of the MFDSP$ routine are called with the EM$MFDSP PROC. The packet<br />

for the MFDSP$ routine is generated with the EM$MFDSPPKT PROC.<br />

Calling Sequence<br />

EM$MFDSP pkt,b-reg [func,param]<br />

where:<br />

pkt<br />

b-reg<br />

func<br />

param<br />

The label (18-bit offset from zero) of the packet generated by the EM$MFDSPPKT<br />

PROC.<br />

The B-register of the bank containing the packet generated by the EM$MFDSPPKT<br />

PROC.<br />

The code for which MFDSP$ function to perform. See Table I–8 for a list of possible<br />

function code values.<br />

An additional parameter for the following function. See Table I–9 for a list of second<br />

parameter values.<br />

The func and param parameters are optional; if they are omitted, EM$MFDSP uses the<br />

values contained in registers A1 and A2, respectively.<br />

7833 1733–004 I–15


Extended Mode Interface to <strong>SYSLIB</strong><br />

Table I–8 contains the function codes that may be used on the EM$MFDSP PROC call.<br />

Table I–8. EM$MFDSP Function Codes<br />

Code Description<br />

0 Initialize MFDSP$ and get the first lead item.<br />

1 Initialize MFDSP$ and get the first main item.<br />

2 Get the next lead item.<br />

3 Get sector 1 of the current lead item.<br />

4 Get the next main item.<br />

5 Get the next sector of the current main item.<br />

6 Get the first DAD table for the current main item.<br />

7 Get the next DAD table.<br />

8 Find an item by its MFD address.<br />

9 Convert an MFD address to the DGET file address.<br />

Table I–9 contains the possible values for the additional parameter field. Function codes<br />

not listed in the table do not require an additional parameter value.<br />

Table I–9. EM$MFDSP Parameter Field Values<br />

Code Description<br />

8 The MFD address of the item to be found<br />

9 The MFD address to be converted<br />

EM$MFDSP returns the status of the call to MFDSP$ in the packet field CALLSTAT.<br />

The CALLSTAT field in S3 of word 2 of the packet (packet address + 1). The possible<br />

status is:<br />

0 Normal return from MFDSP$<br />

1 Error return from MFDSP$ (error code returned in field<br />

A2SAVE)<br />

2 Illegal value given for the MFDSP$ function code<br />

For all calls by EM$MFDSP, the contents of registers A0 through A5 from MFDSP$ are<br />

returned in packet fields A0SAVE, A1SAVE, A2SAVE, A3SAVE, A4SAVE, and A5SAVE,<br />

respectively. These fields are at words 3 through 8 of the packet.<br />

Packet Generation:<br />

The EM$MFDSPPKT PROC generates the packet for the Extended Mode interface to<br />

MFDSP$. This packet is required by the EM$MFDSP PROC.<br />

I–16 7833 1733–004


Calling Sequence:<br />

label EM$MFDSPPKT [buflen] [filename]<br />

where:<br />

buflen<br />

Extended Mode Interface to <strong>SYSLIB</strong><br />

The word length of the buffer used by MFDSP$. This parameter is optional.<br />

If omitted, a value of 4,400 words is used.<br />

filename<br />

The 12-Fieldata-character internal file name of the file containing the MFD<br />

(in quotes). This parameter is optional; if omitted, the caller must place the internal<br />

file name at location EM$MFDSPBUF, an externalized label from this PROC. The<br />

value of this label is the offset from zero to the start of the table.<br />

7833 1733–004 I–17


Extended Mode Interface to <strong>SYSLIB</strong><br />

I–18 7833 1733–004


Appendix J<br />

Obsolete Entry Points, PROCs, and<br />

Routines<br />

This appendix documents PROC calls, entry points, and routines that have been<br />

replaced. Whenever an application is updated that calls these PROCs or entry points, it<br />

should be changed to use the new replacement.<br />

J.1. AEDIT$–Generating the AEDIT$ Packet<br />

The following three MASM procedures that generate the AEDIT$ packet are replaced by<br />

the MASM PROC A$EDITPKT (see 4.1.2).<br />

• A$EPKT (for general-purpose editing)<br />

• A$EPKTF (for floating-point editing)<br />

• A$EPKTSFDT (for date and time editing)<br />

The calling sequences for these MASM procedures are described below. The<br />

parameters in italics are supplied by the calling program. The parameters in brackets are<br />

optional and may be omitted. If they are omitted, the default value is used.<br />

J.1.1. A$EPKT<br />

The A$EPKT procedure generates a seven-word AEDIT$ packet. This packet is used for<br />

general-purpose editing.<br />

Calling Sequence<br />

label A$EPKT image-length,image-address [‘MSG’,msg]<br />

J.1.2. A$EPKTF<br />

The A$EPKTF procedure generates an 11-word AEDIT$ packet. This packet is used for<br />

floating-point number editing.<br />

Calling Sequence<br />

label A$EPKTF image-length,image-address [‘MSG’,msg];<br />

[‘FPS’,fps] [‘FPR’,fpr];<br />

[‘DPC’,dpc] [‘SPC’,spc]<br />

7833 1733–004 J–1


Obsolete Entry Points, PROCs, and Routines<br />

J.1.3. A$EPKTSFDT<br />

A$EPKTSFDT procedure generates a 14-word AEDIT$ packet. This packet is used for<br />

date and time editing.<br />

Calling Sequence<br />

label A$EPKTSFDT image-length,image-address [‘MSG’,msg];<br />

[‘FPS’,fps] [‘FPR’,fpr] [‘DPC’,dpc];<br />

[‘SPC’,spc] [‘DFT’,date-format] [‘TFT’,time-format];<br />

[‘SEP’,separator-character]<br />

J.1.4. Examples of Generating the AEDIT$ Packet<br />

Example 1<br />

$(0)<br />

PACKET A$EPKT 20,ASCIILINE .AEDIT$ packet<br />

ASCIILINE $RES 20 .Data area for ASCII image<br />

In example 1, the MASM procedure A$EPKT generates a seven-word packet at the<br />

location PACKET in location counter 0. AEDIT$ uses this packet for general-purpose<br />

ASCII editing, but not for floating-point numbers or data and time formats. AEDIT$ will<br />

store the generated ASCII string in the 20-word data area at location ASCIILINE. The<br />

message halt character defaults to “&”.<br />

Example 2<br />

LINELEN $EQU 33 .Length of ASCII data area<br />

$(4)<br />

LINE $RES LINELEN .Data area for ASCII image<br />

PACKET A$EPKTSFDT LINELEN,LINE ‘DFT’,8 ‘TFT’,3 .AEDIT$ packet<br />

In example 2, the MASM procedure A$EPKTSFDT generates a 14-word packet for ASCII<br />

editing with date and time formats. AEDIT$ will store the generated ASCII string in the<br />

33-word data area at location LINE. AEDIT$ uses date format index 8 and time format<br />

index 3. AEDIT$ uses the default values for the msg, fps, dps, spc, and<br />

separator-character parameters.<br />

J.2. CONWRD$–MASM PROCs and Entry Points<br />

These entry points to the CONWRD$ routine are replaced by the C$ONWRD PROC<br />

(see Section 7). The common bank entry points are<br />

BCWSET$<br />

Sets bit 8 of the condition word; if bit 8 was already set, then set bit 7.<br />

BCWCLEAR$<br />

Clears bit 8 of the condition word; it does not affect bit 7.<br />

J–2 7833 1733–004


MASM PROCs to call CONWRD$<br />

• Relocatable element<br />

C$WSET<br />

normal return<br />

and<br />

C$WCLEAR<br />

normal return<br />

• Common bank<br />

B$CWSET<br />

normal return<br />

and<br />

B$CWCLEAR<br />

normal return<br />

Obsolete Entry Points, PROCs, and Routines<br />

J.3. EOUT$–Generalized Output Editing Routine<br />

The functionality of EOUT$ is now provided by the AEDIT$ and EDIT$ image<br />

composition editing packages (see Sections 4 and 8).<br />

EOUT$ is an interpretive routine that performs editing functions for Fieldata output<br />

produced for a printer, communications terminal, card punch, or display console.<br />

The interpretive instructions performed by the routine are constructed similarly to<br />

machine language instructions. The format is<br />

f t d x m<br />

0 4 5 11 12 17 18 19 20 35<br />

where:<br />

f<br />

t<br />

d<br />

Function code<br />

Print position (printer) or character position (display console). Print position<br />

numbering starts at zero.<br />

Decimal point location<br />

7833 1733–004 J–3


Obsolete Entry Points, PROCs, and Routines<br />

x<br />

m<br />

Specifies indirect address and use of the simulated index register<br />

Address (main storage location of data)<br />

EOUT$ is called by<br />

LMJ X11,EOUT$<br />

There are two entry points to this subroutine. The normal entry point is EOUT$.<br />

The other, EOUTR$, is the point for reentry after the E$TERM (terminate) function (see<br />

J.3.4).<br />

The addressed word in the m-field may be either in a control register or in main storage.<br />

Any word, even if the word is in a volatile register, is permissible. If register X11 is<br />

addressed, however, the location of the interpretive word that references X11 is output.<br />

All registers, including volatile ones, are saved and restored. The x-field specifies indirect<br />

addressing and the use of the single simulated index register. Its permissible values<br />

(in octal) are as follows:<br />

00 No action<br />

01 Use address indirectly<br />

02 Apply simulated index register<br />

03 Apply simulated index register, then use address indirectly<br />

Indirect addressing is permitted to one level only, and the x-, h-, and i- fields of the<br />

indirectly addressed word are ignored. It is possible, however, to indirectly address<br />

control storage. All modes may be used with indirect addressing.<br />

The various functions are described in the following paragraphs. All may be called as<br />

procedures. Each of the procedure calls generates one word in the correct format. The<br />

parameters of these procedures are interpreted differently, depending on the number<br />

written. A single parameter is taken as m; two parameters as m and x; three parameters<br />

as t, d, and m; and four parameters as t, d, m, and x. Any missing parameters are<br />

assumed to be zero.<br />

The caller may obtain entry to EOUT$ by the procedure E$OUT or E$OUTR, depending<br />

on the entry point desired. No parameters are required.<br />

J–4 7833 1733–004


J.3.1. Editing Functions<br />

Obsolete Entry Points, PROCs, and Routines<br />

These editing functions convert the information to be output. In all cases, except E$A<br />

(alphanumeric words), the field specifies the print position at which the rightmost digit,<br />

bit, or character will be printed. The number given in parentheses following the<br />

procedure call is the octal function code.<br />

E$D(01)–Decimal<br />

The address word is treated as if it were a signed decimal integer and is edited<br />

without a decimal point unless a set function (see E$PNT, J.3.3) is in effect. Leading<br />

zeros to the left are suppressed, and a minus sign, if any, is printed immediately to<br />

the left of the number (also see E$OVRP, J.3.3). If the value is zero, a single zero is<br />

printed. If a set point is in effect, the decimal number is assumed to have the<br />

started point specified by the set point. The d-field specifies the number of decimal<br />

digits to be printed to the right of the decimal point. If a set field function (see<br />

E$FLD, J.3.3) with D = 0 is in effect, the specified field is treated as an unsigned<br />

decimal integer.<br />

E$0(02)–Octal<br />

The d low-order bits of the addressed word are edited and printed as (d+2)/3 octal<br />

digits, unsigned. For a full octal, binary, or alphanumeric character word, d must<br />

always be given as 36.<br />

E$B(03)–Binary<br />

The d low-order bits of the addressed word are edited as d binary digits, unsigned.<br />

E$C(04)–Alphanumeric Characters<br />

The d low-order bits of the addressed word are edited and printed as (d+5)/6<br />

alphanumeric characters in Fieldata code.<br />

E$A(05)–Alphanumeric Words<br />

The d words beginning with the addressed word are edited as 6*d characters in<br />

Fieldata code. For this editing function only, the t-field specifies the print position at<br />

which the leftmost character is printed.<br />

E$E(06)–Floating-Point (FORTRAN E)<br />

The addressed word is edited as a floating-point number with d significant digits.<br />

Normally these are all printed to the right of the decimal point (see E$SCL, J.3.3).<br />

A decimal exponent consisting of a sign and 2 digits is inserted immediately to the<br />

right of the significant portion. If the floating-point number is negative, a minus sign<br />

is inserted immediately to the left of the number (see E$OVRP, J.3.3). If the<br />

addressed word is minus zero, there is no effect and the field is left blank.<br />

7833 1733–004 J–5


Obsolete Entry Points, PROCs, and Routines<br />

E$F(07)–Floating-to-Fixed (FORTRAN F)<br />

The addressed word is assumed to be a floating-point number and is edited to fixed<br />

point with d places following the decimal point. Negative numbers, including minus<br />

zero, are treated as in E$E.<br />

E$DE(26)–Double-Precision Floating-Point<br />

This editing function is the same as E$E, with the addressed word and the<br />

addressed word plus one edited as a double-precision, floating-point number. A<br />

decimal exponent consisting of a sign and 3 digits is inserted immediately to the<br />

right of the significant portion.<br />

E$DF(27)–Double-Precision Floating-to-Fixed<br />

EIMG$<br />

This editing function is the same as E$F, with the addressed word and the<br />

addressed word plus one edited as a double-precision, floating-point number.<br />

The edited output of EOUT$ is stored in a 22-word buffer in the EOUT$ D-bank<br />

following the externally defined label EIMG$.<br />

E$CENT<br />

The text at m is edited as a centered string. The parameters m and x may be given;<br />

in addition, a third parameter is required to specify the number of characters in the<br />

string. The string will be centered in a 128-character line and edited by a call to E$A.<br />

J.3.2. Output Functions<br />

The output functions serve to transmit the edited line to an output device. The device to<br />

be used is determined by the d-field:<br />

Printer d=0<br />

Card Punch d=1<br />

Display Console d=2<br />

The word or character count is given in the t-field. This count must be given. (It is not<br />

assumed maximum if it is given as zero.) For the printer, the word count is normally 22;<br />

for the card punch, normally 14. For the display console, the t-field is a character count<br />

and cannot be more than 60.<br />

For the printer, the m-field serves to specify the number of lines to be spaced. A value<br />

greater than the length of a logical page results in printing on the first line of the next<br />

page. For the punch and display console, the m-field is ignored. The number given in<br />

parentheses following the procedure call is the octal function code.<br />

J–6 7833 1733–004


E$WT(10)–Write and Terminate<br />

Obsolete Entry Points, PROCs, and Routines<br />

The edited image is transmitted to the specified device, and the routine returns<br />

control to the next instruction in machine language mode. The image is not reset to<br />

blanks.<br />

E$W(11)–Write<br />

The edited image is transmitted to the specified device and the routine continues in<br />

the interpretive mode. The image is reset to blanks.<br />

E$WS(12)–Write and Save<br />

The edited image is transmitted to the specified device and the routine continues to<br />

the next instruction in the interpretive mode. The image remains available for use by<br />

further output functions or further editing.<br />

J.3.3. Modal Functions<br />

The modal functions serve to enter information that affects the interpretation of one or<br />

more of the instructions that follow. The number given in parentheses following the<br />

procedure call is the octal function code.<br />

E$SCL(13)–Set Scale<br />

The contents of the address field are treated as a signed power of 10 to be applied<br />

to any floating-point or floating-to-fixed function that follows the set scale function.<br />

For floating-point, the scale is the number of digits to be printed to the left of the<br />

decimal point. The exponent field is reduced accordingly, so that the resulting value<br />

is the same as if no set scale function were in effect. Negative values of the<br />

address (the 16-bit ones complement) introduce leading zeros after the decimal point<br />

and increase the exponent field accordingly.<br />

For floating-to-fixed conversion, the actual value of the resulting number is altered by<br />

multiplying it by the power of 10 indicated by the address. The set scale function<br />

remains in effect until it is countermanded by a new set scale. Upon initial entry to<br />

EOUT$, the scale is assumed to be 0.<br />

E$PNT(14)–Set Point<br />

The set point function specifies the position of the binary point for the next editing<br />

function to be encountered (presumably a decimal editing function). It remains in<br />

effect only for the single edit. The address of the set point gives the number of bits<br />

following the binary point. Negative values are permitted (see E$FLD).<br />

7833 1733–004 J–7


Obsolete Entry Points, PROCs, and Routines<br />

E$FLD(15)–Set Field<br />

The set field function is used to specify a subfield of the next word to occur<br />

(presumably decimal, octal, binary or alphanumeric character function). The t-field<br />

specifies the left margin and the m-field the right margin. The bits of the machine<br />

word are numbered, for the purposes of this function, from left (00) to right (35).<br />

The d-field specifies extension of sign; if it is nonzero, the field is treated as sign.<br />

A set field function with d=0 and t=0 may be used to treat fields, including the sign<br />

bit, as unsigned unless m=35. (That is, a whole word must always be signed in the<br />

event a sign is applied.)<br />

The set field function remains in effect only for the next function encountered.<br />

If both a set field and a set point function are in effect when editing occurs, the set<br />

field function is applied first. In this case, the set point function specifies the binary<br />

point counting from the right-hand end of the specified field.<br />

E$INDX(16)–Set Index<br />

The set index function is used to address a quantity in main storage that is to be<br />

loaded into the single simulated index register. For any function that addresses<br />

storage (including this one), the presence of a 1 bit in the increment (h) portion of the<br />

address causes the simulated index to be added to the specified address before<br />

access is made. The left half of the index register word is ignored. If the d-field is<br />

nonzero, the contents of the m-field (with sign extension) are loaded into the<br />

simulated index register. The set index function remains in effect until it is<br />

countermanded by another set index function.<br />

E$OVRP(17)–Overpunch<br />

The overpunch function specifies that any minus signs produced by the editing<br />

functions are to be removed from their positions in front of the edited numbers and<br />

placed as 11-punches over the low-order digits. In the case of floating-point editing,<br />

the sign of the mantissa is placed over the low-order digit of the mantissa and the<br />

sign of the exponent over its low-order digit. The space that would normally contain<br />

the sign of the exponent is omitted.<br />

The overpunch function is initiated by its occurrence with address 1. It is<br />

countermanded by its occurrence with address 0. Upon initial entry to EOUT$,<br />

the overpunch mode is assumed to be off.<br />

J.3.4. Control Functions<br />

The control functions introduce some of the control operations available in machine<br />

language into the interpretive language. The number in parentheses following the<br />

procedure call is the octal function code.<br />

J–8 7833 1733–004


E$TERM(20)–Terminate<br />

Obsolete Entry Points, PROCs, and Routines<br />

The terminate function returns the routine to the next instruction in machine<br />

language. Upon reentry at point EOUTR$, all counters, modes in effect, interpretive<br />

subroutines, and any partial image are left undisturbed. Control is returned to the<br />

next instruction in machine code. If reentry is made at EOUT$, these are all cleared<br />

and control is returned to the interpretive mode. Entry at EOUT$ is made by:<br />

LMJ X11,EOUTR$<br />

E$LINK(21)–Link<br />

The link function forms subroutines in the editing language. Its effective address<br />

specifies the location of the entry to a subroutine. Subroutines may be nested to a<br />

depth of 10.<br />

E$JUMP(22)–Jump<br />

The jump function with a nonzero effective address causes an interpretive transfer of<br />

control to the designated location. If the address is zero, the jump function serves<br />

as a subroutine exit. Transfer is to the interpretive function following that link control<br />

most recently executed for which no exit has been performed.<br />

E$RPT(23)–Repeat<br />

The repeat function causes the next single interpretive function to be repeated the<br />

number of times specified in the d-field of the repeat word. A repeat function<br />

preceding E$LINK is meaningless; for multiple execution of E$LINK, the routine<br />

EOUT$ should be called within a machine language loop. The t- and m-fields contain<br />

increments to the t- and m-fields of the instruction to be repeated for each<br />

execution. Any modes set by the modal functions which would be in effect for the<br />

first execution of a repeated instruction remain in effect for all executions.<br />

E$CLR(24)–Clear<br />

The clear function sets the image to blanks.<br />

J.3.5. EOUT$–Calling Sequences<br />

This section shows some typing EOUT$ calling sequences. (The FORTRAN formatting<br />

merely indicates the format desired. The I/O functions in FORTRAN use an editing<br />

scheme peculiar to themselves.)<br />

7833 1733–004 J–9


Obsolete Entry Points, PROCs, and Routines<br />

Example 1<br />

The FORTRAN instruction<br />

PRINT 100,A,I,N,B,C<br />

100 FORMAT (6X,E20.7, I20, O20, 1P2F20.6)<br />

is equivalent to the following interpretive sequences:<br />

E$OUT<br />

E$E 26,7,A<br />

E$D 46,0,I<br />

E$0 66,36,N<br />

E$SCL 1<br />

E$F 86,6,B<br />

E$F 106,6,C<br />

E$WT 22,0,1<br />

Next machine language instruction.<br />

Example 2<br />

If this line is punched on a card punch whose output code is 1, then the last interpretive<br />

instruction is replaced by<br />

E$WS 14,1,0<br />

E$WT 22,0,1<br />

Only the first 80 columns of the image are punched.<br />

Example 3<br />

The FORTRAN statements<br />

PRINT 100 (J (I), K (I), L (I), M (I), I=1,4)<br />

100 FORMAT (20I6)<br />

are equivalent to the following interpretive sequences:<br />

E$RPT 30,4,1<br />

E$D 6,0,J,2<br />

E$RPT 30,4,1<br />

E$D 12,0,K,2<br />

E$RPT 30,4,1<br />

E$D 18,0,L,2<br />

E$RPT 30,4,1<br />

E$D 24,0,M,2<br />

E$WT 22,0,1<br />

J–10 7833 1733–004


J.4. I$D–Calling Sequence<br />

Obsolete Entry Points, PROCs, and Routines<br />

The I$D PROC to call the ID$ routine is replaced by the I$D$ PROC (see 11.1.2).<br />

The following MASM procedure calls ID$:<br />

I$D pktaddr date<br />

error return<br />

normal return<br />

where:<br />

pktaddr<br />

date<br />

address of the ID$ packet.<br />

address of caller-specified date and time (must be in TDATE$ format). This<br />

parameter is optional.<br />

The calling program can use indexing, incrementation, indirect addressing, and register<br />

basing in specifying the addresses for pktaddr and date with the $EQUF directive in the<br />

following format:<br />

label $EQUF,j *u,*x,,*b<br />

If date is included on the calling statement, the TDATE$ value at that address is used for<br />

the execution date/time. If the date is excluded, the TDATE$ value in word 8 of the ID$<br />

packet is used. If no value is present in word 8, the current date/time is obtained from<br />

ER TDATE$.<br />

Error Return<br />

If ID$ takes the error return, either A1 or A2 contains a negative error code. If the error<br />

occurred in ID$, A1 contains the error code; if the error occurred in SFDT$, A2 contains<br />

the error code.<br />

• ID$ error codes (returned in A1):<br />

-01 An outdated version of the ID$ packet is being used.<br />

• SFDT$ error codes (returned in A2):<br />

-01 through -05 SFDT$ routine error; see Section 22.<br />

The error code is also stored in the packet, in ERRCODE.<br />

7833 1733–004 J–11


Obsolete Entry Points, PROCs, and Routines<br />

Normal Return<br />

The output ID$ generates may be one or more lines; this depends on the length of the<br />

processor/program description and specified options. For each line of ID$ output, a print<br />

control word is constructed (line-spacing, image-length, image-address) and stored<br />

sequentially in the ID$ packet starting with word 10. The number of print control words<br />

constructed is stored in S6 or word 0 of the ID$ packet.<br />

If the normal return occurs, the first print control word is returned in A0.<br />

The following procedure simplifies printing of the ID$ output:<br />

I$DPRINT pktaddr<br />

where pktaddr is the address of the ID$ packet.<br />

This procedure performs an APRINT$ for each print control word. It may be called from<br />

the I$D PROC by setting option bit 4.<br />

All output from ID$ is directed to the current print file.<br />

Example of Calling ID$<br />

The following example calls the ID$ routine to generate an ASCII identification line:<br />

$ASCII<br />

$INCLUDE ‘MAXR$’<br />

$(0)<br />

IDPAC I$DPKT ‘IDLINE$ ‘Math Quiz Program (Level 8)’026<br />

$(1)<br />

START I$D IDPAC . Generate and print the ID line<br />

J ERROR . Jump ahead if error return<br />

.<br />

. (Program code)<br />

.<br />

J DONE . Program complete<br />

ERROR L$SNAP ‘ID$’,2 . Dump the A-registers<br />

DONE ER EXIT$<br />

$END START<br />

This MASM routine uses the ID$ routine to create and print the following identification<br />

line:<br />

Math Quiz Program (Level 8) 840425 1147:31<br />

In this example, ID$ generates the ASCII identification line in the 11-word data area at<br />

location IDLINE. The I$DPKT procedure generates the ID$ packet (see Example 2 in the<br />

previous subsection).<br />

J–12 7833 1733–004


Obsolete Entry Points, PROCs, and Routines<br />

The I$D procedure calls ID$, which generates the identification line and prints it by<br />

executing an ER APRINT$ (because option bit 4 is set).<br />

If ID$ takes the error return, L$SNAP prints the A registers. Otherwise, the program<br />

continues executing.<br />

J.5. IDLINE$ and IDONLY$–Identification Line<br />

Routines<br />

The IDLINE$ and IDONLY$ routines are replaced by the ID$ routine (see Section 11).<br />

IDLINE$ and IDONLY$ are routines that provide a standard identification line for Series<br />

1100 system, language, and utility processors. IDLINE$ and IDONLY$ are reentrant and<br />

not quarter/third-word sensitive. Do not call IDLINE$ and IDONLY$ from a minor register<br />

set activity.<br />

Identification Line Format<br />

A standard processor identification line is generated in a processor-supplied buffer called<br />

IDBUFF. All fields but the processor name and level field are generated. The element<br />

cycle information field is optional. All information is generated in Fieldata code beginning<br />

after the last nonblank character and preceded by one blank character.<br />

The format of the complete ID line is<br />

ppplll <strong>SYSLIB</strong> mm/dd/yy hh:mm:ss (old->new)<br />

where:<br />

ppplll<br />

<strong>SYSLIB</strong><br />

processor name and level, 12 characters or less, supplied by the processor.<br />

<strong>SYSLIB</strong> level the processor is collected with. The form varies with the level number.<br />

For example, SL74R1, 74R1Q1.<br />

mm/dd/yy<br />

month/day/year at processor call.<br />

hh:mm:ss<br />

hour:minute:second at processor call.<br />

(old->new)<br />

input-> output symbolic element cycle number (optional).<br />

7833 1733–004 J–13


Obsolete Entry Points, PROCs, and Routines<br />

IDBUFF<br />

The processor must supply a buffer with an externally defined label, IDBUFF. Before<br />

calling IDLINE$ or IDONLY$, this buffer must be initialized with the name/level field (up<br />

to 12 characters) left-justified and the remainder of the buffer blank-filled. This buffer<br />

must be at least six words long and up to eight, depending on the name/level length and<br />

whether or not cycle information is requested.<br />

The minimum IDBUFF length required is shown in Table J–1.<br />

Table J–1. IDLINE$, IDONLY$: IDBUFF<br />

Length<br />

Routine Called Name and Level Length<br />

1 Word 2 Words<br />

IDLINE$,IDTIME$ 7 8<br />

IDONLY$,IDTOME$ 6 7<br />

A processor name and level greater than 12 characters may be used by defining the start<br />

of IDBUFF as the word following the name and level. It may also be used if no more<br />

than the last 12 characters are included within IDBUFF.<br />

J.5.1. IDLINE$<br />

There are two entry points to the IDLINE$ routine: IDLINE$ and IDTIME$.<br />

J.5.1.1. IDLINE$<br />

IDLINE$ generates the complete ID line, including symbolic element cycle information.<br />

The element cycle information is taken from PARTBL, which is filled in by either the<br />

<strong>SYSLIB</strong> routine PREPRM or PREPRO. The call on PREPRM or PREPRO must precede<br />

the call on IDLINE$ or IDTIME$.<br />

Calling Sequence<br />

LMJ X11,PREPRO$ . or PREPRM$<br />

J ERROR . error return from PREPRO$ or PREPRM$<br />

LMJ X11,IDLINE$<br />

.<br />

PF FORM 12,6,18<br />

LA A0,(PF 1,8,IDBUFF)<br />

ER PRINT$<br />

J–14 7833 1733–004


J.5.1.2. IDTIME$<br />

Obsolete Entry Points, PROCs, and Routines<br />

The IDLINE$ call is the equivalent of IDLINE$, except that you furnish the date (in<br />

register R2) and time (in register R3) in ER DATE$ format. IDTIME$ can be used by a<br />

processor that executes for a considerable time before it prints the ID line. In this case,<br />

the actual date and time that the processor began execution are saved and then passed<br />

to IDLINE$ in registers R2 and R3.<br />

J.5.2. IDONLY$<br />

There are two entry points to the IDONLY$ routine: IDONLY$ and IDTOME$.<br />

J.5.2.1. IDONLY$<br />

IDONLY$ generates the ID line without the symbolic element cycle information.<br />

IDONLY$ can be used by processors that do not create or update elements. An<br />

externally defined PARTBL is not required.<br />

Calling Sequence<br />

LMJ X11,IDONLY$<br />

.<br />

PF FORM 12,6,18<br />

LA A0,(PF 1,7,IDBUFF)<br />

ER PRINT$<br />

J.5.2.2. IDTOME$<br />

The IDTOME$ call is the equivalent of IDONLY$, except that you furnish the date (in R2)<br />

and time (in R3) in ER DATE$ format.<br />

J.6. SFDT$–MASM Calling Sequence<br />

The S$FDT PROC to call the SFDT$ routine is replaced by the S$FDT$ PROC (see<br />

22.1.2).<br />

The S$FDT procedure call obtains the standard format for date, time, or both date and<br />

time:<br />

S$FDT pkt-addr date time<br />

error return<br />

normal return<br />

where:<br />

pkt-addr<br />

the address of the five-word SFDT$ packet.<br />

7833 1733–004 J–15


Obsolete Entry Points, PROCs, and Routines<br />

date<br />

time<br />

the address of a caller-specified date and time (must be in TDATE$ format). This<br />

parameter is optional.<br />

the address of a caller-specified time (must be in TIME$ format). This parameter is<br />

optional.<br />

J.7. SYS$RLIB$ID–RLIB Identification<br />

SYS$RLIB$ID is an element that contains the level identification of the system<br />

relocatable library file, SYS$*RLIB$ (also referred to as RLIB). It defines the following<br />

external labels:<br />

RLIB$ID1 First four characters of ID in ASCII<br />

RLIB$ID2 Second four characters of ID in ASCII<br />

RLIB$ID3 Third four characters of ID in ASCII<br />

If a site makes changes to SYS$*RLIB$, it should update the level identification of this<br />

file.<br />

The SYS$*RLIB$ file ID is updated by assembling the element SYS$RLIB$ID and<br />

supplying the new ID in the fourth parameter field of the @MASM processor call. The ID<br />

may be from 1 to 12 characters long.<br />

Example<br />

@MASM,S SYS$*RLIB$.SYS$RLIB$ID,.SYS$RLIB$ID,,840713<br />

where 840713 is the new ID.<br />

This example generates the following definitions:<br />

RLIB$ID1* $EQU ‘8407’<br />

RLIB$ID2* $EQU ‘13∆∆’<br />

RLIB$ID3* $EQU ‘∆∆∆∆’<br />

J–16 7833 1733–004


Obsolete Entry Points, PROCs, and Routines<br />

J.8. PIRCB$ Common Bank Entry Points<br />

Table J–2 lists the routines and entry points for <strong>SYSLIB</strong> common bank PIRCB$. PIRCB$<br />

is replaced by the common banks <strong>SYSLIB</strong>$1, <strong>SYSLIB</strong>$2, <strong>SYSLIB</strong>$3, and <strong>SYSLIB</strong>$4. The<br />

common bank entry points listed in Table J–2 should not be used; instead, use the<br />

common bank calling sequence documented in the description of these routines.<br />

Table J–2. PIRCB$ Entry Points<br />

Element Name Relocatable Entry Point Common Bank Entry Point<br />

BSP$ APTIA$ BAPTIA$<br />

APTID$ BAPTID$<br />

APTIS$ BAPTIS$<br />

APTNL$ BAPTNL$<br />

CPTIA$ BCPTIA$<br />

CPTID$ BCPTID$<br />

CPTIS$ BCPTIS$<br />

CPTNL$ BCPTNL$<br />

EPTIA$ BEPTIA$<br />

EPTID$ BEPTID$<br />

EPTIS$ BEPTIS$<br />

EPTNL$ BEPTNL$<br />

ETIA$ BETIA$<br />

ETID$ BETID$<br />

ETIS$ BETIS$<br />

ETNL$ BETNL$<br />

FPTIA$ BFPTIA$<br />

FPTID$ BFPTID$<br />

FPTIS$ BFPTIS$<br />

FPTNL$ BFPTNL$<br />

PTATWT$ BPTATWT$<br />

PTCTWT$ BPTCTWT$<br />

PTETWT$ BPTETWT$<br />

PTEWT$ BPTEWT$<br />

PTFTWT$ BPTFTWT$<br />

RFTI$ BRFTI$<br />

RPFAPT$ BRPFAPT$<br />

7833 1733–004 J–17


Obsolete Entry Points, PROCs, and Routines<br />

Table J–2. PIRCB$ Entry Points<br />

Element Name Relocatable Entry Point Common Bank Entry Point<br />

BSP$ (cont.) RPFCPT$ BRPFCPT$<br />

RPFEPT$ BRPFEPT$<br />

RPFET$ BRPFET$<br />

RPFFPT$ BRPFFPT$<br />

WFTI$ BWFTI$<br />

WPFAPT$ BWPFAPT$<br />

WPFCPT$ BWPFCPT$<br />

WPFEPT$ BWPFEPT$<br />

WPFET$ BWPFET$<br />

WPFFPT$ BWPFFPT$<br />

CONWRD$ CWCLEAR$ BCWCLEAR$<br />

CWSET$ BCWSET$<br />

FDASC$ ASCFD$ BASCFD$<br />

FDASC$ BFDASC$<br />

ID$ ID$ BID$<br />

SAR$ATREAD$G SAR$ATR$PG BSAR$ATR$P<br />

SAR$INATR$PG BSAR$INATR$P<br />

SAR$COM$G SAR$COM$PG BSAR$COM$P<br />

SAR$READ$G SAR$CLOSI$PG BSAR$CLOSI$P<br />

SAR$OPENI$PG BSAR$OPENI$P<br />

SAR$READ$PG BSAR$READ$P<br />

SAR$WRITE$G SAR$CLOSO$PG BSAR$CLOSO$P<br />

SAR$OPENO$PG BSAR$OPENO$P<br />

SAR$WCNTL$PG BSAR$WCNTL$P<br />

SAR$WRITE$PG BSAR$WRITE$P<br />

SDFI SDFIC$ BSDFIC$<br />

SDFINT$ BSDFINT$<br />

SDFIOA$ BSDFIOA$<br />

SDFIO$ BSDFIO$<br />

SDFI$ BSDFI$<br />

J–18 7833 1733–004


Obsolete Entry Points, PROCs, and Routines<br />

Table J–2. PIRCB$ Entry Points<br />

Element Name Relocatable Entry Point Common Bank Entry Point<br />

SDFO SDFOC$ BSDFOC$<br />

SDFOOSF$ BSDFOOSF$<br />

SDFOO$ BSDFOO$<br />

SDFO$ BSDFO$<br />

SFDT$ SFDT$ BSFDT$<br />

STARTSFDT$ BSTARTSFDT$<br />

7833 1733–004 J–19


Obsolete Entry Points, PROCs, and Routines<br />

J–20 7833 1733–004


Appendix K<br />

Related Product Information<br />

OS 2200 Exec System Software Administration <strong>Reference</strong> <strong>Manual</strong> (7831 0323).<br />

Unisys Corporation.<br />

OS 2200 Exec System Software Executive Requests <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong><br />

(7830 7899). Unisys Corporation.<br />

OS 2200 Executive Control Language (ECL) and FURPUR <strong>Reference</strong> <strong>Manual</strong><br />

(7830 7949). Unisys Corporation.<br />

OS 1100 Meta-Assembler (MASM) <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> (7830 8269).<br />

Unisys Corporation.<br />

OS 2200 Exec System Software Installation and Configuration Guide (78306 7915).<br />

Unisys Corporation.<br />

OS 1100 Collector <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> (7830 9887). Unisys Corporation.<br />

OS 1100 LIST Processor (LIST) End Use Guide (7831 3384). Unisys Corporation.<br />

OS 1100 Universal Compiling System (UCS) FORTRAN <strong>Programming</strong> <strong>Reference</strong><br />

<strong>Manual</strong> Volume 1, FORTRAN Statements (7831 0489). Unisys Corporation.<br />

Unisys e-@ction Application Development Solutions FORTRAN Compiler <strong>Programming</strong><br />

<strong>Reference</strong> <strong>Manual</strong> Volume 2: Compiler and System Interface (7830 7477).<br />

Unisys Corporation.<br />

OS 1100 Universal Compiling System (UCS) PLUS <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong><br />

Volume 1, PLUS Statements (7831 0497). Unisys Corporation.<br />

OS 1100 Universal Compiling System (UCS) PLUS <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong><br />

Volume 2, Compiler and System Interface (7831 2287). Unisys Corporation.<br />

OS 2200 Data Structures <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> (7833 3481).<br />

Unisys Corporation.<br />

OS 2200 Service Library <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> (7830 7857).<br />

Unisys Corporation.<br />

OS 2200 System Services <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> (7833 4455).<br />

Unisys Corporation.<br />

7833 1733–004 K–1


Related Product Information<br />

OS 1100 Exec System Software Executive Request <strong>Programming</strong> Quick-<strong>Reference</strong> Guide<br />

(7830 9952). Unisys Corporation.<br />

OS 1100 Postmortem Dump (PMD) <strong>Programming</strong> <strong>Reference</strong> <strong>Manual</strong> (UP-8725).<br />

Unisys Corporation.<br />

K–2 7833 1733–004


Glossary<br />

B<br />

bank descriptor index (BDI)<br />

An index into the bank descriptor table (a data structure defined by the Exec). Practically,<br />

BDIs are the equivalent of symbolic bank names. Program BDIs are assigned by the<br />

Collector, whereas configured common bank BDIs are managed by the Exec, COMUS,<br />

and the systems analyst, or<br />

C<br />

An integer value used as a relative index into a bank descriptor table (BDT). The BDI<br />

points to a bank descriptor (BD) in the BDT that defines storage allocation for a program<br />

segment, or<br />

An unsigned integer in the range of zero to n-1, where n is the maximum number of<br />

bank descriptors allowed in a given bank descriptor table. The integer is used to locate a<br />

bank descriptor in the bank descriptor table. The first bank descriptor has an index of<br />

zero and the nth bank descriptor has an index of n-1. The bank descriptor index is the<br />

low order 16 bits of L,BDI and the low order 12 bits of E,LS,BDI.<br />

Collector<br />

A system processor (called using @MAP) that joins relocatable elements into an absolute<br />

element.<br />

D<br />

DAD<br />

E<br />

ECL<br />

Abbreviation for device area descriptor.<br />

Abbreviation for Executive control language.<br />

Element (ELT) processor<br />

Processor used to introduce a new element into a program file or to correct the content<br />

of a symbolic element in a program file from a runstream.<br />

7833 1733–004 Glossary–1


Glossary<br />

Exec<br />

The kernel of the OS 2200 system that controls the operating environment. The Exec<br />

process user runs, controls files, manages the system resources, and performs input and<br />

output operations. The active Exec is the Exec that is currently booted. The default<br />

Exec is the Exec to be booted the next time the device is manually selected as the boot<br />

device without explicitly selecting, through the SCF interface, an Exec to boot.<br />

Executive request (ER)<br />

A machine instruction that allows a user to request services from the kernel, or<br />

F<br />

A system call to the OS 2200 Exec that asks the Exec to perform a task (such as I/O) that<br />

is normally privileged and outside the control of the user. The ER is the standard<br />

interface between programs and the operating system, providing programs with access<br />

to system resources under Exec control. Selected ERs affect system security and their<br />

ability to be executed is controlled, or<br />

A program instruction that interrupts the Exec and has it perform a function for the<br />

program. An ER can be used to read or print data, request system information, and<br />

terminate a program. Executive request also refers to the service resulting from the<br />

request.<br />

Fault Location by Interpretive Testing (FLIT)<br />

A tool for development, checkout, installation, and maintenance of software, and for<br />

solving complex debugging problems. FLIT provides a simulated operating environment<br />

where you can run and debug any OS 2200 compatible executable program. Working in<br />

this simulated environment, a programmer can load and execute object code, trace<br />

execution of the code, and change it dynamically without recompiling. Debugging is<br />

controlled by a high-level language (HLL) or low-level language (LLL). Typically, Meta-<br />

Assembler (MASM) programs are debugged using LLL, and PLUS programs are<br />

debugged using HLL. In system mode, you can customize the hardware environment<br />

and boot, run, and debug your own operating system or control program.<br />

FURPUR<br />

The operating system Executive file utility routine. Abbreviation for File Utility<br />

Routines/Program Utility Routines.<br />

Glossary–2 7833 1733–004


M<br />

Glossary<br />

master file directory (MFD)<br />

The file catalog of the Executive that contains Exec file definitions that the system or<br />

users can assign and access. Files listed in the MFD are said to be cataloged and are<br />

retained after a run terminates. In an XTC system, there is a single shared MFD for the<br />

system, and each host has its own standard (local) copy of the MFD. See also standard<br />

MFD, shared MFD, or<br />

P<br />

A directory maintained by the Exec to control cataloged files. The MFD contains the<br />

security attributes for cataloged files. Files listed in the MFD are cataloged and retained<br />

after a run terminates. MFDF$$ is the internal file name that refers to the MFD, or<br />

A list of all the files currently cataloged in the computer system. The file may not<br />

currently be in either main or mass storage, but if cataloged, it will be listed in the MFD<br />

until it is deleted.<br />

post mortem dump processor (PMDP)<br />

A system processor that produces a printout (dump) of the main storage a program<br />

occupied when it terminated. Experienced programmers can use these dumps to<br />

determine what processing occurred. This helps isolate errors in a program.<br />

Programmers Advanced Debugging System<br />

A language-independent interactive debugging tool.<br />

Processor common input/output system (PCIOS)<br />

A system that handles data in conventional PCIOS files.<br />

program control table (PCT)<br />

A special table maintained by the Exec for each active run in the system. The PCT<br />

contains control information about a particular run, and about the program currently being<br />

executed in the run (if any). Among other things, the PCT includes a list of the files<br />

currently assigned to the run, or<br />

A table, one per run, created and maintained by the Exec to accummulate data needed to<br />

control and record each run. The PCT is a read-only user bank from 1 to 42 blocks, or<br />

A bank whose data structure is defined, created, and maintained by the operating<br />

system. The PCT contains information about the run, or<br />

An area in main storage containing the information necessary to define the state of the<br />

program. The PCT shows contents of the P-register, the next instruction to be executed,<br />

and the contents of various data registers. With the information in the program control<br />

table, the Exec can stop the program and resume it exactly where it left off.<br />

7833 1733–004 Glossary–3


Glossary<br />

Problem list entry (PLE)<br />

An organized list of user reported problems, or<br />

R<br />

A unique software problem that has been reported to Unisys and recorded in the<br />

PRIMUS database.<br />

relocatable element<br />

A machine language element produced by a compiler; an object program. Relocatable<br />

elements must still undergo the process of collection before they can be executed. The<br />

system relocatable library has the file name SYS$RLIB$.relocable subroutine library.<br />

S<br />

A component of the operating system that contains useful subroutines you can<br />

incorporate into your programs. Among other things, these subroutines sort and merge<br />

data and perform mathematical and statistical operations.<br />

Software Library Administrator (SOLAR)<br />

A software tool that a site or system administrator uses to install and maintain software<br />

products. SOLAR consists of a set of utilities and the SOLAR processor–a full screen<br />

interface to the utilities.<br />

System data format (SDF)<br />

The standard format used by the Exec to format data for storage in data files. The Exec<br />

system data format is sequential, fixed-block, variable-record length, or<br />

<strong>SYSLIB</strong><br />

U<br />

Files that contain only symbolic images (data, directives, or runstreams) in system data<br />

format (SDF). They are commonly used as print files or for data storage. Data files can<br />

be stored on mass storage (disk) or on tape.<br />

Abbreviation for System Service Routines Library, which is a Unisys software product.<br />

Its file name is SYS$LIB$*<strong>SYSLIB</strong>. It contains system definitions and procedures and<br />

processor interface and utility routines.<br />

Universal Compiling System (UCS)<br />

A system for compiling extended mode programs written in UCS FORTRAN or UCS<br />

COBOL. The UCS compilers produce an absolute element in a standard form that is<br />

called an object module. The UCS and Linking system allow object modules written in<br />

different languages to be linked together as a program. See also object module, OS<br />

2200 linking system, zero overhead object module (ZOOM).<br />

Glossary–4 7833 1733–004


Index<br />

A<br />

Access Methods<br />

common bank, 3-3<br />

relocatable, 3-2<br />

ACD<br />

attributes, 16-12<br />

internal format, 16-12<br />

output, 18-35<br />

Addressing routines, 6-1<br />

AEDIT$<br />

calling sequence, 4-6, 4-7<br />

description, 4-1<br />

error status codes, 4-24<br />

examples, 4-5, 4-13, 4-25<br />

packet format, 4-3<br />

packet generation, 4-4<br />

AEDIT$F<br />

calling sequence, 4-6, 4-16<br />

description, 4-14<br />

error status codes, 4-24<br />

examples, 4-17<br />

AEDIT$SFDT<br />

calling sequence, 4-6, 4-21<br />

error status codes, 4-24<br />

AEDIT$SFDT$<br />

examples, 4-23<br />

ASCII<br />

A$SCTRL procedure, 2-4<br />

conversion table, 9-3<br />

conversion to Fieldata, 9-1<br />

input, 17-33, 23-13<br />

output, 18-35, 23-13, 25-3<br />

Attributed Character Data<br />

attributes, 16-12<br />

internal format, 16-12<br />

output, 18-35<br />

B<br />

BSP$<br />

examples, 5-34<br />

File Control Table, 5-5<br />

functions, 5-1<br />

7833 1733–004 Index–1<br />

C<br />

CABSAD$, 6-1, 6-2<br />

CAINIT$, 6-4<br />

Calling Sequences<br />

auto switch, 3-5<br />

common bank, 3-3<br />

relocatable, 3-2<br />

CBX$, 6-5<br />

common bank routines, 3-1<br />

Common Banks, 3-1<br />

CRELAD$<br />

calling, 6-8<br />

CBN$, 6-13<br />

CRELAD$, 6-9<br />

CRINIT$, 6-12<br />

CSN$, 6-14<br />

description, 6-1<br />

CSX$, 6-6<br />

CSYMVL$, 6-7<br />

CYCLIM$, 2-8<br />

D<br />

Debugging routines<br />

CABSAD$, 6-1<br />

CONWRD$, 7-1<br />

CRELAD$, 6-1<br />

Diagnostic routines<br />

CABSAD$, 6-1<br />

CRELAD$, 6-1<br />

E<br />

Editing<br />

ASCII characters, 4-1<br />

dates, 4-18, 8-8, 22-1


Index<br />

Fieldata characters, 8-1<br />

floating point numbers, 8-9<br />

times, 4-18, 8-8, 22-1<br />

Editing routines<br />

AEDIT$F, 4-14<br />

AEDIT$T, 4-18<br />

EDIT$, 8-1<br />

EDIT$F, 8-9<br />

EDIT$T, 8-8<br />

element subtypes, 2-4<br />

Error status codes<br />

AEDIT$, 4-24<br />

CABSAD$, 6-4<br />

CAINIT$, 6-5<br />

CBN$, 6-13<br />

CBX$, 6-6<br />

CLOSR$ (SIR$), 23-19<br />

CRELAD$, 6-11<br />

CRINIT$, 6-13<br />

CSN$, 6-14<br />

CSX$, 6-7<br />

CSYMVL$, 6-8<br />

entry look_up (BSP$), 5-19<br />

EROR$, 15-6<br />

GETPSF$, 10-4<br />

ID$, 11-6<br />

INISR$ (SIR$), 23-11<br />

item add (BSP$), 5-24<br />

item delete (BSP$), 5-15<br />

item search (BSP$), 5-12<br />

MFDSP$, 13-5<br />

OPNSR$ (SIR$), 23-11<br />

POSTPR$, 14-14<br />

PREPRO$, 14-2<br />

read table (SP$), 5-10<br />

REPRM$, 14-8<br />

REPRO$, 14-8<br />

RINF$, 12-5<br />

ROR$, 15-2<br />

SAR$ ATREAD, 19-23<br />

SAR$ COM, 20-19<br />

SAR$ READ, 17-30<br />

SAR$ WRITE, 18-19<br />

SDFI, 21-18<br />

SDFO, 21-18<br />

SELT$, 12-11<br />

SFDT$, 22-6, 22-11<br />

SINF$, 12-7<br />

SOR, 25-2<br />

SROR$, 15-2<br />

TBLWR$, 15-7<br />

write FTI (BSP$), 5-33<br />

write last item (BSP$), 5-30, 5-31<br />

write table (BSP$), 5-32<br />

Index–2 7833 1733–004<br />

F<br />

Fieldata<br />

conversion table, 9-3<br />

editing, 8-1<br />

input, 17-33, 23-13<br />

File Information Packet<br />

fields (PLUS), 16-2<br />

File Table Index<br />

format, 5-5<br />

reading, 5-4<br />

G<br />

GETPSF$<br />

description, 10-1<br />

error status codes, 10-4<br />

examples, 10-5<br />

MASM calling sequence, 10-2<br />

I<br />

I/O routines, 21-1<br />

ID$<br />

error status codes, 11-6<br />

examples, 11-4, 11-7, 11-11<br />

MASM calling sequence, 11-5<br />

MASM packet format, 11-12<br />

PLUS calling sequence, 11-8<br />

PLUS packet, 11-8<br />

INFOR<br />

format, G-3<br />

reading the table, G-9<br />

subfield number, G-2<br />

table conventions, G-7<br />

table size, G-9<br />

INFOR$<br />

description, 12-1<br />

DUSE$, 12-11<br />

guidelines, 12-2<br />

RINF$, 12-4<br />

SELT$, 12-8<br />

SINF$, 12-6


K<br />

Kanji<br />

input, 17-34<br />

internal format, 16-12<br />

output, 18-35<br />

M<br />

MFDSP$<br />

calling sequence, 13-2<br />

error status codes, 13-5<br />

examples, 13-9<br />

function codes, 13-3<br />

information returned, 13-4<br />

packet, 13-1<br />

N<br />

Nonsupported routines<br />

AEDIT$T, 4-18<br />

EDIT$, 8-1<br />

EDIT$F, 8-9<br />

P<br />

PARTBL<br />

description, 14-5<br />

format, 14-3<br />

PLUS callable routines<br />

CONWRD$, 7-1<br />

ID$, 11-1<br />

SAR$, 16-1<br />

SFDT$, 22-1<br />

Processor Interface Routines, 14-1<br />

Processors<br />

call statement, 12-1<br />

field release, 14-14<br />

field retrieval, 14-10<br />

file assignments, 14-3<br />

Program File<br />

adding items, 5-23<br />

deleting items, 5-14<br />

file table index, 5-5<br />

Searching for, 5-11<br />

searching for items, 5-18<br />

Index<br />

7833 1733–004 Index–3<br />

R<br />

Read routines<br />

SDFI, 21-1<br />

ROR<br />

description, 15-1<br />

EROR$, 15-6<br />

external reference item, 15-5<br />

large location counter item, 15-5<br />

location counter item, 15-4<br />

optimization, 15-7<br />

ROR$, 15-2<br />

SROR$, 15-1<br />

SROR$EB, 15-2<br />

TBLWR$, 15-6<br />

RPCTA$, 2-8<br />

S<br />

SAR$<br />

attribute table entry, 16-12, 17-11, 18-11<br />

attributes, 16-12<br />

character sets, 17-33, 18-34<br />

description, 16-1<br />

error, 19-11<br />

error status, 18-32<br />

error status codes<br />

(ATREAD), 19-23<br />

(COM), 20-9, 20-19<br />

(READ), 17-17, 17-30<br />

(WRITE), 18-19<br />

examples, 17-16, 18-18<br />

file information packet<br />

about, 16-2<br />

MASM<br />

ATREAD function, 19-13<br />

COM function, 20-11<br />

WRITE function, 18-21<br />

PLUS<br />

ATREAD function, 19-1<br />

COM function, 20-1<br />

READ function, 17-1<br />

SAR$ ATREAD$G<br />

MASM interface, 19-1<br />

PLUS interface, 19-13<br />

SDFI<br />

close call, 21-10<br />

description, 21-1<br />

error status codes, 21-18<br />

open call, 21-7<br />

packet format, 21-3


Index<br />

read call, 21-8<br />

SDFO<br />

close call, 21-17<br />

description, 21-1<br />

error status codes, 21-18<br />

open call, 21-16<br />

packet format, 21-11<br />

write call, 21-17<br />

SFDT$<br />

error status codes, 22-6, 22-11<br />

examples, 22-7, 22-12<br />

MASM calling sequence, 22-5<br />

MASM packet format, 22-3<br />

PLUS calling sequence, 22-11<br />

PLUS packet format, 22-8<br />

SIR$<br />

close call, 23-19<br />

description, 23-1<br />

entry points, 23-10<br />

get, 23-18<br />

get image call, 23-13<br />

open call, 23-10, 23-11<br />

options, 23-6<br />

SNOOPY<br />

calling sequence, 24-3<br />

commands, 24-8<br />

control flags, 24-18<br />

demand mode, 24-5<br />

description, 24-1<br />

SYS$DEF System Standard Definitions<br />

PCTBD$, 2-8<br />

PFAPT$, 2-8<br />

PFCPT$, 2-8<br />

PFEPT$, 2-8<br />

PFET$, 2-8<br />

PFFPT$, 2-8<br />

PFTEXT$, 2-8<br />

W<br />

Write routines<br />

SDFO, 21-1<br />

Index–4 7833 1733–004


*78331733-004*<br />

78331733–004

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!