home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / REXXEA.ZIP / REXXEA.INF (.txt) < prev   
OS/2 Help File  |  1992-11-10  |  14KB  |  545 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. Introduction ΓòÉΓòÉΓòÉ
  3.  
  4.  
  5.                 Copyright 1992 Ammonoosuc Technology, Inc.
  6.  
  7. This document describes the REXXEA package, a set of functions accessible to a 
  8. REXX program for processing extended attributes associated with a file or a 
  9. subdirectory. Extended attributes are available only when the underlying file 
  10. system explicitly supports them. Currently, in the OS/2 environment, the only 
  11. file system which supports extended attributes is the HPFS file system. For a 
  12. complete description of extended attributes, the user is referred to Chapter 5 
  13. of the Programming Guide, Volume 1 of the OS/2 2.0 Technical Library. This 
  14. package subsumes the extended attribute functions included with the distributed 
  15. REXX function package REXXUTIL. This was done because the functions in the 
  16. REXXUTIL package do not support operations on extended attributes associated 
  17. with subdirectories (the HPFS file system does not support extended attributes 
  18. associated with the root directory of a partition). 
  19.  
  20.  
  21. ΓòÉΓòÉΓòÉ 2. General considerations ΓòÉΓòÉΓòÉ
  22.  
  23. The individual functions listed below all have some general requirements for 
  24. use. These are as follows: 
  25.  
  26.  1. All functions must be loaded before they can be invoked. 
  27.  
  28.     All the functions listed here must be loaded before they can be used. 
  29.     Loading is performed by invoking the RxFuncAdd function. Thus, to load one 
  30.     of the functions in this package would require the following call in the 
  31.     REXX program: 
  32.  
  33.         Call RxFuncAdd 'FetchEA', 'RexxEA', 'FetchEA'
  34.     Note that the third parameter, although redundant, is required. 
  35.     Additionally, each function that has been loaded should be deleted by 
  36.     invoking RxFuncDrop before the REXX procedure that used them exits. 
  37.  
  38.  2. Pathnames must be fully specified. 
  39.  
  40.     All the functions in this package require as one of their parameters a 
  41.     pathname specifying either a file name or a subdirectory name. This must be 
  42.     the fully qualified name including the drive letter where this is 
  43.     appropriate. Failure to fully specify the pathname will result in an error 
  44.     message from the invoked function. 
  45.  
  46.  
  47. ΓòÉΓòÉΓòÉ 3. Function descriptions. ΓòÉΓòÉΓòÉ
  48.  
  49. The functions provided in this package and their parameters and returns are as 
  50. follows: 
  51.  
  52.  
  53. ΓòÉΓòÉΓòÉ 3.1. FetchEA ΓòÉΓòÉΓòÉ
  54.  
  55. Call FetchEA pathname, 'names', 'strings'
  56.  
  57. or
  58.  
  59. result = FetchEA( pathname, 'names', 'strings')
  60.  
  61. This function will return a list of names for each extended attributes 
  62. associated with a file or subdirectory. It will also return an array of strings 
  63. representing the data associated with each extended attribute. The parameter 
  64. list for invocation of this function must consist of 3 parameters. These 
  65. parameters are as follows: 
  66.  
  67. pathname 
  68.           The fully qualified name of the file or subdirectory whose extended 
  69.           attributes will be returned. The only limitation on the length of 
  70.           this string is that imposed by the file system. 
  71.  
  72. namestem 
  73.           A string containing the name of a REXX stem variable which will 
  74.           contain the names of the extended attributes upon return. Thus, if 
  75.           the value of this parameter is 'names', upon successful return, the 
  76.           REXX variable names.0 will contain the count of the number of 
  77.           extended attributes associated with the file or subdirectory. Note 
  78.           that this value may be 0 if there are no extended attributes. If 
  79.           names.0 is nonzero, then names.i will contain the name of the i'th 
  80.           extended attribute. The order in which the names are returned is 
  81.           generally unpredictable. 
  82.  
  83. stringstem 
  84.           A string containing the name of a REXX stem variable which will 
  85.           contain the values of the extended attributes upon return. Thus, if 
  86.           the value of this parameter is 'strings', then, upon successful 
  87.           return, the REXX variable strings.0 will contain the count of the 
  88.           number of extended attributes. Note that this information is 
  89.           redundant. If this count is nonzero then strings.i will contain the 
  90.           data associated with the i'th extended attribute. 
  91.  
  92. Return values 
  93.  
  94. Normally this function will return a zero length string either in the special 
  95. REXX variable RESULT or in the explicit result variable, depending on how it is 
  96. invoked. However if errors are encountered during execution of this function, 
  97. an error message is returned. In this case, the returned variables specified in 
  98. arguments 2 and 3 will be invalid. Thus a typical sequence for invoking this 
  99. function might appear as follows: 
  100.  
  101.  
  102. call FetchEA arg1, arg2, arg3
  103. if length(RESULT) <> 0 then do;
  104.    say 'Error encountered. Error message is' RESULT
  105.    exit
  106.    end;
  107.  
  108. The possible error messages and their explanations are as follows: 
  109.  
  110. Mismatched function name at invocation of FetchEA
  111. Should never occur. If it does, it is an internal error in the REXX processor. 
  112.  
  113. Incorrect argument count to FetchEA, received n, expected 3.
  114. In this message, n is a number other than 3. This corrective action required is 
  115. self-explanatory. 
  116.  
  117. Argument n to FetchEA is NULL.
  118. In this message, n may be 1 through 3. It indicates that the n'th argument to 
  119. this function is a zero length string. 
  120.  
  121. Return code from DosQueryPathInfo is n.
  122. Refer to the Control Program Programming Reference for the meaning of the 
  123. return code. 
  124.  
  125. Return code from DosOpen is n.
  126. Refer to the Control Program Programming Reference for the meaning of the 
  127. return code. 
  128.  
  129. Return code from DosEnumAttribute is n.
  130. Refer to the Control Program Programming Reference for the meaning of the 
  131. return code. 
  132.  
  133. Return code from RexxVariablePool is n.
  134. Refer to the REXX Reference for the meaning of the return code. If this message 
  135. occurs, it is probably indicative of an internal error in FetchEA. 
  136.  
  137.  
  138. ΓòÉΓòÉΓòÉ 3.2. EAType ΓòÉΓòÉΓòÉ
  139.  
  140. type = EAType(EA_Data_String)
  141.  
  142. This function returns the type of an extended attribute, given the data string 
  143. associated with the extended attribute. The possible types of an extended 
  144. attribute are described in Chapter 4 of the Programming Guide, Volume I. The 
  145. type is returned as a character string and is the return value returned by the 
  146. function. The possible returned types are as follows: 
  147.  
  148. BINARY 
  149. ASCII 
  150. BITMAP 
  151. METAFILE 
  152. ICON 
  153. EA 
  154. MVMT 
  155. MVST 
  156. ASN1 
  157. UNKNOWN 
  158. USER_DEFINED 
  159.  
  160. Return values 
  161.  
  162. Normally, this function returns the type of the extended attribute data in its 
  163. return value. However, if an error is an encountered, an error message is 
  164. returned. Error messages are always prefaced by the string 'Error:' separated 
  165. from the error message text by a blank character. Thus a typical use of this 
  166. function might look like the following: 
  167.  
  168. retval = EAType(string_value)
  169. parse var retval x errormsg
  170. if x = 'Error:' then do;
  171.    say 'Error in EAType, error message is' errormsg
  172.    exit
  173.    end;
  174.  
  175. The possible error messages and their explanations are as follows: 
  176.  
  177. Mismatched function name at invocation of EAType.
  178. Should never occur. If it does, it is an internal error in the REXX processor. 
  179.  
  180. Incorrect argument count to EAType, received %d, expected 1.
  181. In this message, n is a number other than 1. This corrective action required is 
  182. self-explanatory. 
  183.  
  184. Input argument is NULL.
  185. This message indicates that the argument to this function is a zero length 
  186. string. 
  187.  
  188.  
  189. ΓòÉΓòÉΓòÉ 3.3. MVSTEA ΓòÉΓòÉΓòÉ
  190.  
  191. Call MVSTEA EA_value_string, codepage_var, numvalues_var, EAtype_var
  192.  
  193. or
  194.  
  195. result = MVSTEA(EA_value_string, codepage_var, numvalues_var, EAtype_var)
  196.  
  197. This function will process an extended attribute data value with a type of 
  198. MVST. An MVST data value consists of an array of individual data values, all of 
  199. the same type. Invoking this function will return the codepage of the data, a 
  200. count of the number of data items, and the type of each data item (in the 
  201. extended attribute sense). This function takes 4 arguments. 
  202.  
  203. EA_value_string 
  204.           The data string of the MVST extended attribute. 
  205.  
  206. codepage_var 
  207.           A string containing the name of a REXX variable which, upon return, 
  208.           will contain the codepage of the extended attribute data. 
  209.  
  210. numvalues_var 
  211.           A string containing the name of a REXX variable which, upon return, 
  212.           will contain the number of data items associated with the MVST data 
  213.           value. 
  214.  
  215. EAtype_var 
  216.           A string containing the name of a REXX variable which, upon return, 
  217.           will contain the type of the data items. This type will be expressed 
  218.           as a string with the same values returned by the EAType function. 
  219.  
  220. Return values 
  221.  
  222. Normally this function will return a zero length string either in the special 
  223. REXX variable RESULT or in the explicit result variable, depending on how it is 
  224. invoked. However if errors are encountered during execution of this function, 
  225. an error message is returned. In this case, the returned variables specified in 
  226. arguments 2, 3, and 4 will be invalid. Thus a typical sequence for invoking 
  227. this function might appear as follows: 
  228.  
  229.  
  230. call MVSTEA arg1, arg2, arg3, arg4
  231. if length(RESULT) <> 0 then do;
  232.    say 'Error encountered. Error message is' RESULT
  233.    exit
  234.    end;
  235.  
  236. The possible error messages and their explanations are as follows: 
  237.  
  238. Mismatched function name at invocation of MVSTEA
  239. Should never occur. If it does, it is an internal error in the REXX processor. 
  240.  
  241. Incorrect argument count to MVSTEA, received n, expected 4.
  242. In this message, n is a number other than 4. The corrective action required is 
  243. self-explanatory. 
  244.  
  245. Argument n to MVSTEA is NULL.
  246. In this message, n may be 1 through 4. It indicates that the n'th argument to 
  247. this function is a zero length string. 
  248.  
  249. Return code from RexxVariablePool is n.
  250. Refer to the REXX Reference for the meaning of the return code. If this message 
  251. occurs, it is probably indicative of an internal error in MVSTEA. 
  252.  
  253.  
  254. ΓòÉΓòÉΓòÉ 3.4. MVSTASC ΓòÉΓòÉΓòÉ
  255.  
  256. Call MVSTASC EAdata_string, string_var
  257.  
  258. or
  259.  
  260. result = MVSTASC( EAdata_string, string_var)
  261.  
  262. This function may be invoked to decompose an MVST extended attribute where the 
  263. data type of the individual items is ASCII. The argument list for invocation of 
  264. this function must consist of 2 parameters. These parameters are as follows: 
  265.  
  266. EAdata_string 
  267.           A string containing the data for the MVST extended attribute. 
  268.  
  269. string_var 
  270.           A string containing the name of a REXX stem variable which, upon 
  271.           return, will contain the individual ASCII strings. Specifically, the 
  272.           variable string_var.0 will contain the count of the number of ASCII 
  273.           strings returned. The variable string_var.i will contain the i'th 
  274.           ASCII string. 
  275.  
  276. Return values 
  277.  
  278. Normally this function will return a zero length string either in the special 
  279. REXX variable RESULT or in the explicit result variable, depending on how it is 
  280. invoked. However if errors are encountered during execution of this function, 
  281. an error message is returned. In this case, the returned variable specified in 
  282. argument 2 will be invalid. Thus a typical sequence for invoking this function 
  283. might appear as follows: 
  284.  
  285.  
  286. call MVSTASC arg1, arg2
  287. if length(RESULT) <> 0 then do;
  288.    say 'Error encountered. Error message is' RESULT
  289.    exit
  290.    end;
  291.  
  292. The possible error messages and their explanations are as follows: 
  293.  
  294. Mismatched function name at invocation of MVSTASC
  295. Should never occur. If it does, it is an internal error in the REXX processor. 
  296.  
  297. Incorrect argument count to MVSTASC, received n, expected 2.
  298. In this message, n is a number other than 2. The corrective action required is 
  299. self-explanatory. 
  300.  
  301. Argument n to MVSTASC is NULL.
  302. In this message, n may be 1 through 2. It indicates that the n'th argument to 
  303. this function is a zero length string. 
  304.  
  305. Input data to MVSTASC does not have ASCII data in it.
  306. The input data to MVSTASC is an MVST extended attribute but the data type is 
  307. not ASCII. 
  308.  
  309. Return code from RexxVariablePool is n.
  310. Refer to the REXX Reference for the meaning of the return code. If this message 
  311. occurs, it is probably indicative of an internal error in MVSTASC. 
  312.  
  313.  
  314. ΓòÉΓòÉΓòÉ 3.5. ASCIIEA ΓòÉΓòÉΓòÉ
  315.  
  316. string = ASCIIEA(EA_Data_String)
  317.  
  318. This function returns a string which is the data associated with an extended 
  319. attribute whose type is ASCII. It strips off all the headers and returns only 
  320. the actual ASCII data. The input parameter to this function is: 
  321.  
  322. EA_Data_String 
  323.           A string containing the data for the ASCII extended attribute. 
  324.  
  325. Return values 
  326.  
  327. Normally, this function returns the ASCII data associated with the extended 
  328. attribute in its return value. However, if an error is an encountered, an error 
  329. message is returned. Error messages are always prefaced by the string 'Error:' 
  330. separated from the error message text by a blank character. Thus a typical use 
  331. of this function might look like the following: 
  332.  
  333. retval = EAType(string_value)
  334. parse var retval x errormsg
  335. if x = 'Error:' then do;
  336.    say 'Error in ASCIIEA, error message is' errormsg
  337.    exit
  338.    end;
  339.  
  340. The possible error messages and their explanations are as follows: 
  341.  
  342. Mismatched function name at invocation of ASCIIEA.
  343. Should never occur. If it does, it is an internal error in the REXX processor. 
  344.  
  345. Incorrect argument count to ASCIIEA, received n, expected 1.
  346. In this message, n is a number other than 1. This corrective action required is 
  347. self-explanatory. 
  348.  
  349. Input argument is NULL.
  350. This message indicates that the argument to this function is a zero length 
  351. string. 
  352.  
  353. Input argument is not a valid ASCII Extended Attribute.
  354. The input argument is not a valid ASCII Extended Attribute. 
  355.  
  356.  
  357. ΓòÉΓòÉΓòÉ 3.6. MVMTEA ΓòÉΓòÉΓòÉ
  358.  
  359. Call MVMTEA EA_value_string, codepage_var, EAtype_var, EAdata_var
  360.  
  361. or
  362.  
  363. result = MVMTEA(EA_value_string, codepage_var, EAtype_var, EAdata_var)
  364.  
  365. This function will process an extended attribute data value with a type of 
  366. MVMT. An MVMT data value consists of an array of individual data values. These 
  367. data items are of heterogeneous type. Invoking this function will return the 
  368. codepage of the data, the type of each data item (in the extended attribute 
  369. sense), and the actual string associated with each item. This function takes 4 
  370. arguments. 
  371.  
  372. EA_value_string 
  373.           The data string of the MVMT extended attribute. 
  374.  
  375. codepage_var 
  376.           A string containing the name of a REXX variable which, upon return, 
  377.           will contain the codepage of the extended attribute data. 
  378.  
  379. EAtype_var 
  380.           A string containing the name of a REXX stem variable which, upon 
  381.           return, will contain the number of data items associated with the 
  382.           MVMT extended attribute and the type of each data item. Specifically 
  383.           upon return, the variable EAtype_var.0 will contain the number of 
  384.           data items associated with the MVMT extended attribute. The 
  385.           variable(s) EAtype_var.i will contain the data type of the i'th data 
  386.           item in the same format as returned by the EAType function. 
  387.  
  388. EAdata_var 
  389.           A string containing the name of a REXX stem variable which, upon 
  390.           return, will contain the number of data items and the actual data 
  391.           strings for each item. Specifically, EAdata_var.0 will contain the 
  392.           number of data items associated with the MVMT extended attribute 
  393.           (redundantly). The variables(s) EAdata_var.i will contain the actual 
  394.           data strings for each data item, will all headers removed. 
  395.  
  396. Return values 
  397.  
  398. Normally this function will return a zero length string either in the special 
  399. REXX variable RESULT or in the explicit result variable, depending on how it is 
  400. invoked. However if errors are encountered during execution of this function, 
  401. an error message is returned. In this case, the returned variables specified in 
  402. arguments 2, 3, and 4 will be invalid. Thus a typical sequence for invoking 
  403. this function might appear as follows: 
  404.  
  405.  
  406. call MVMTEA arg1, arg2, arg3, arg4
  407. if length(RESULT) <> 0 then do;
  408.    say 'Error encountered. Error message is' RESULT
  409.    exit
  410.    end;
  411.  
  412. The possible error messages and their explanations are as follows: 
  413.  
  414. Mismatched function name at invocation of MVMTEA
  415. Should never occur. If it does, it is an internal error in the REXX processor. 
  416.  
  417. Incorrect argument count to MVMTEA, received n, expected 4.
  418. In this message, n is a number other than 4. The corrective action required is 
  419. self-explanatory. 
  420.  
  421. Argument n to MVMTEA is NULL.
  422. In this message, n may be 1 through 4. It indicates that the n'th argument to 
  423. this function is a zero length string. 
  424.  
  425. Data value passed to MVMTEA is not an MVMT Extended Attribute
  426. The input data string does not correspond to an MVMT extended attribute. 
  427.  
  428.  
  429. ΓòÉΓòÉΓòÉ 3.7. DeleteEA ΓòÉΓòÉΓòÉ
  430.  
  431. Call DeleteEA pathname, EAname
  432.  
  433. or
  434.  
  435. result = DeleteEA(pathname, EAname)
  436.  
  437. This function will delete a single extended attribute associated with a file or 
  438. subdirectory. The extended attribute named as an argument must exist. 
  439. Otherwise, this function will return an error message. The arguments to this 
  440. function are as follows: 
  441.  
  442. pathname 
  443.           The fully qualified name of the file or subdirectory which will have 
  444.           an extended attribute deleted. The only limitation on the length of 
  445.           this string is that imposed by the file system. 
  446.  
  447. EAname 
  448.           The name of the extended attribute to be deleted. 
  449.  
  450. Return values 
  451.  
  452. Normally this function will return a zero length string either in the special 
  453. REXX variable RESULT or in the explicit result variable, depending on how it is 
  454. invoked. However if errors are encountered during execution of this function, 
  455. an error message is returned. Thus a typical sequence for invoking this 
  456. function might appear as follows: 
  457.  
  458.  
  459. call DeleteEA arg1, arg2
  460. if length(RESULT) <> 0 then do;
  461.    say 'Error encountered. Error message is' RESULT
  462.    exit
  463.    end;
  464.  
  465. The possible error messages and their explanations are as follows: 
  466.  
  467. Mismatched function name at invocation of DeleteEA
  468. Should never occur. If it does, it is an internal error in the REXX processor. 
  469.  
  470. Incorrect argument count to DeleteEA, received n, expected 2.
  471. In this message, n is a number other than 2. The corrective action required is 
  472. self-explanatory. 
  473.  
  474. Argument n to DeleteEA is NULL.
  475. In this message, n may be 1 through 2. It indicates that the n'th argument to 
  476. this function is a zero length string. 
  477.  
  478. Return code from DosSetPathInfo is n.
  479. Refer to the documentation for the control program function DosSetPathInfo for 
  480. the meaning of n. Some of the causes for this message include an invalid 
  481. pathname and a nonexistent extended attribute name. 
  482.  
  483.  
  484. ΓòÉΓòÉΓòÉ 3.8. PutEA ΓòÉΓòÉΓòÉ
  485.  
  486. Call PutEA pathname, EAname, EAdata
  487.  
  488. or
  489.  
  490. result = PutEA(pathname, EAname, EAdata)
  491.  
  492. This function will either create or update a single extended attribute 
  493. associated with a file or subdirectory. The extended attribute named as the 
  494. second argument need not exist. If it does, the data for an existing extended 
  495. attribute will be updated. Otherwise, a new extended attribute will be created. 
  496. The arguments to this function are as follows: 
  497.  
  498. pathname 
  499.           The fully qualified name of the file or subdirectory which will have 
  500.           an extended attribute updated or created. The only limitation on the 
  501.           length of this string is that imposed by the file system. 
  502.  
  503. EAname 
  504.           The name of the extended attribute to be updated or created. 
  505.  
  506. EAdata 
  507.           A string containing the data for the extended attribute, including 
  508.           all headers. Note that since this data is a character string, bytes 
  509.           contained in a word must be swapped before this function is invoked. 
  510.           This function simply passes through the data string to the 
  511.           appropriate control program function call. This data string must have 
  512.           nonzero length. 
  513.  
  514. Return values 
  515.  
  516. Normally this function will return a zero length string either in the special 
  517. REXX variable RESULT or in the explicit result variable, depending on how it is 
  518. invoked. However if errors are encountered during execution of this function, 
  519. an error message is returned. Thus a typical sequence for invoking this 
  520. function might appear as follows: 
  521.  
  522.  
  523. call PutEA arg1, arg2, arg3
  524. if length(RESULT) <> 0 then do;
  525.    say 'Error encountered. Error message is' RESULT
  526.    exit
  527.    end;
  528.  
  529. The possible error messages and their explanations are as follows: 
  530.  
  531. Mismatched function name at invocation of PutEA
  532. Should never occur. If it does, it is an internal error in the REXX processor. 
  533.  
  534. Incorrect argument count to PutEA, received n, expected 3.
  535. In this message, n is a number other than 3. The corrective action required is 
  536. self-explanatory. 
  537.  
  538. Argument n to PutEA is NULL.
  539. In this message, n may be 1 through 3. It indicates that the n'th argument to 
  540. this function is a zero length string. 
  541.  
  542. Return code from DosSetPathInfo is n.
  543. Refer to the documentation for the control program function DosSetPathInfo for 
  544. the meaning of n. One of the causes for this message is an invalid pathname. 
  545.