IBM / zopeneditor-about

IBM Z Open Editor: File issues here!
https://ibm.github.io/zopeneditor-about
Apache License 2.0
49 stars 21 forks source link

All languages (COBOL first) - Contextual property-groups #243

Open FALLAI-Denis opened 2 years ago

FALLAI-Denis commented 2 years ago

Description of the enhancement requested

Z Open Editor allows property-groups to be declared in the settings.json file or in the zapp.yaml file. These property-groups serve among other things to search for COPYBOOKs / INCLUDEs on the remote mvs system.

The names of the libraries, (syslib), are not necessarily fixed, but can depend on a context: the user code (mvs), the Git branch (part of branch name), and any other context information.

Is there a way to introduce variables into the information managed by property groups? The values of these variables could be declared elsewhere, either in the user's settings.json file, or in the workspace's settings.json, or through VS Code's context variables, or by dynamic calculation when searching.

Use case: we want to reference user-level libraries in property-groups, (&SYSUID..xxxx.COPYLIB).

Note: the userid is an information available in the z/OSMF (or RSE) profile.

FALLAI-Denis commented 2 years ago

Json validation sProperty-groups support VS Code variable as ${varname}.

Moreover, I tried using an mvs variable in a syslib name:

  - name: cobol-mvs
    language: cobol
    type: mvs
    syslib:
      - "&SYSUID..PUBLIC.COBOL.COPYLIB"
      - "DSGETU.PERMIBL.SIRIS.COPY"
      - "RSGREF.PERMIBL.SIRIS.COPY"
2022-05-16T13:14:58.808+0200 DEBUG: ZoweResourceResolver.checkMVSConnection: Running a Zowe profile connection test using the profile "GMVS" by reading data set "sys1.proclib".
2022-05-16T13:14:59.405+0200 DEBUG: ZoweResourceResolver.downloadMVSDataset(RequestId:c8802): Looking for data set member "&SYSUID..PUBLIC.COBOL.COPYLIB(THECOPY)" on MVS using Zowe CLI Profile "GMVS". 
2022-05-16T13:14:59.610+0200 DEBUG: ZoweResourceResolver.downloadMVSDataset(RequestId:c8802): Data set member search request for "&SYSUID..PUBLIC.COBOL.COPYLIB(THECOPY)" returned: 
>>> z/OSMF REST API Error:
Rest API failure with HTTP(S) status 500
category: 1
rc:       4
reason:   3
message:  Data set name is not valid
details: 
  - IKJ56231I UTILITY DATA SET NOT ALLOCATED, SYSTEM OR INSTALLATION ERROR+    
  - IKJ56231I TEXT UNIT X'0002' CONTAINS INVALID PARAMETER    
[13:14:59.597630] ServletDispatcher[I]: Received request: GET /ds/&SYSUID..PUBLIC.COBOL.COPYLIB(THECOPY)                   
[13:14:59.597641] ServletDispatcher[I]: z/OSMF transaction: tx0000000000000513                                             
[13:14:59.597664] ServletDispatcher[I]: Invoking Servlet: SELECT  PGM(IZUGGTDS) PARM(-LI,t -q 5570572 -r 0x29bf5690 )      
[13:14:59.604326] GetDatasetServlet[E]: BPXWDYN allocation failed S99ERROR=0x035C S99INFO=0x0002                           
[13:14:59.604332] GetDatasetServlet[E]: BPXWDYN command was: "alloc da('&SYSUID..PUBLIC.COBOL.COPYLIB(THECOPY)')  SHR      
gdgnt mount"                                                                                                               
[13:14:59.604351] GetDatasetServlet[W]: IKJ56231I UTILITY DATA SET NOT ALLOCATED, SYSTEM OR INSTALLATION ERROR+            
[13:14:59.604353] GetDatasetServlet[W]: IKJ56231I TEXT UNIT X'0002' CONTAINS INVALID PARAMETER                             
[13:14:59.604736] ServletDispatcher[I]: Servlet IZUGGTDS completed,  RC=0                                                  

TEXT UNIT X'0002' is dsname...

According to the documentation of the SVC 99, on the management of file names, it would be possible to use variables if the file name is specified between apostrophes: https://www.ibm.com/docs/en/zos/2.2.0?topic=units-dsname-specification-key-0002

Try this:

  - name: cobol-mvs
    language: cobol
    type: mvs
    syslib:
      - "'&SYSUID..PUBLIC.COBOL.COPYLIB'"
      - "DSGETU.PERMIBL.SIRIS.COPY"
      - "RSGREF.PERMIBL.SIRIS.COPY"

Get this:

2022-05-16T13:25:59.667+0200 DEBUG: ZoweResourceResolver.downloadMVSDataset(RequestId:dldzi9): Looking for data set member "'&SYSUID..PUBLIC.COBOL.COPYLIB'(THECOPY)" on MVS using Zowe CLI Profile "GMVS". 
2022-05-16T13:25:59.846+0200 DEBUG: ZoweResourceResolver.downloadMVSDataset(RequestId:dldzi9): Data set member search request for "'&SYSUID..PUBLIC.COBOL.COPYLIB'(THECOPY)" returned: 
>>> z/OSMF REST API Error:
Rest API failure with HTTP(S) status 500
category: 1
rc:       4
reason:   3
message:  Data set name is not valid
details: 
  - IKJ56231I UTILITY DATA SET NOT ALLOCATED, SYSTEM OR INSTALLATION ERROR+    
  - IKJ56231I TEXT UNIT X'0002' CONTAINS INVALID PARAMETER 

Try also:

  - name: cobol-mvs
    language: cobol
    type: mvs
    syslib:
      - "${env:USERNAME}.PUBLIC.COBOL.COPYLIB"
      - "DSGETU.PERMIBL.SIRIS.COPY"
      - "RSGREF.PERMIBL.SIRIS.COPY"

${env:USERNAME} not resolved... same for ${config:property}

2022-05-16T13:46:14.098+0200 DEBUG: ZoweResourceResolver.checkMVSConnection: Running a Zowe profile connection test using the profile "GMVS" by reading data set "sys1.proclib".
2022-05-16T13:46:14.286+0200 DEBUG: ZoweResourceResolver.downloadMVSDataset(RequestId:84zlm9): Looking for data set member "${env:USERNAME}.PUBLIC.COBOL.COPYLIB(THECOPY)" on MVS using Zowe CLI Profile "GMVS". 
2022-05-16T13:46:14.318+0200 DEBUG: ZoweResourceResolver.downloadMVSDataset(RequestId:84zlm9): Data set member search request for "${env:USERNAME}.PUBLIC.COBOL.COPYLIB(THECOPY)" returned: 
>>> EINVAL: invalid argument, mkdir 'C:/Trv/DepotsGIT/Temp/temp/_D_/GMVS/${env:USERNAME}.PUBLIC.COBOL.COPYLIB/'
<<<. If it is a Not Found error then no problem, will look in other property group locations.
FALLAI-Denis commented 2 years ago

Related to Use of symbols in dataset name or files for zowe/zowe-cli. I think it will be difficult...