@profoundlogic/codermake 2.0.7 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -255,6 +255,38 @@ $(SET_LIBL)
255
255
  system "crtprtf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
256
256
  endef
257
257
 
258
+ # Build System/38 display file
259
+ define BUILD_DSPF38_TO_FILE
260
+ $(call SETUP_LOG,$(notdir $@))
261
+ $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
262
+ $(SET_LIBL)
263
+ system "qsys38/crtdspf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
264
+ endef
265
+
266
+ # Build System/38 physical file
267
+ define BUILD_PF38_TO_FILE
268
+ $(call SETUP_LOG,$(notdir $@))
269
+ $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
270
+ $(SET_LIBL)
271
+ system "qsys38/crtpf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
272
+ endef
273
+
274
+ # Build System/38 logical file
275
+ define BUILD_LF38_TO_FILE
276
+ $(call SETUP_LOG,$(notdir $@))
277
+ $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
278
+ $(SET_LIBL)
279
+ system "qsys38/crtlf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
280
+ endef
281
+
282
+ # Build System/38 printer file
283
+ define BUILD_PRTF38_TO_FILE
284
+ $(call SETUP_LOG,$(notdir $@))
285
+ $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
286
+ $(SET_LIBL)
287
+ system "qsys38/crtprtf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
288
+ endef
289
+
258
290
  # Build SQL table
259
291
  define BUILD_SQLTABLE_TO_FILE
260
292
  $(call SETUP_LOG,$(notdir $@))
@@ -283,6 +315,26 @@ $(SET_LIBL)
283
315
  system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))"
284
316
  endef
285
317
 
318
+ # Build SQL procedure as a service program.
319
+ # An SQL procedure whose source uses PROGRAM TYPE SUB is backed by a *SRVPGM.
320
+ # codermake only runs the SQL statement; IBM i creates the *SRVPGM and derives
321
+ # its object name from the routine (name it to match the target where practical).
322
+ define BUILD_SQLPROC_TO_SRVPGM
323
+ $(call SETUP_LOG,$(notdir $@))
324
+ $(SET_LIBL)
325
+ system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))"
326
+ endef
327
+
328
+ # Build SQL UDF (CREATE FUNCTION ... LANGUAGE SQL) as a service program.
329
+ # SQL UDFs are backed by *SRVPGM objects. codermake only runs the SQL statement;
330
+ # IBM i creates the *SRVPGM and derives its object name from the routine (name it
331
+ # to match the target where practical).
332
+ define BUILD_SQLUDF_TO_SRVPGM
333
+ $(call SETUP_LOG,$(notdir $@))
334
+ $(SET_LIBL)
335
+ system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))"
336
+ endef
337
+
286
338
  # Build message file from CL commands
287
339
  define BUILD_MSGF
288
340
  $(call SETUP_LOG,$(notdir $@))
@@ -367,6 +367,50 @@ EOF
367
367
  touch '$@'
368
368
  endef
369
369
 
370
+ # Build System/38 display file
371
+ define BUILD_DSPF38_TO_FILE
372
+ $(call SETUP_LOG,$(notdir $@))
373
+ $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
374
+ $(SSH) $(QSHELL) <<'EOF'
375
+ $(SET_LIBL)
376
+ system "qsys38/crtdspf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
377
+ EOF
378
+ touch '$@'
379
+ endef
380
+
381
+ # Build System/38 physical file
382
+ define BUILD_PF38_TO_FILE
383
+ $(call SETUP_LOG,$(notdir $@))
384
+ $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
385
+ $(SSH) $(QSHELL) <<'EOF'
386
+ $(SET_LIBL)
387
+ system "qsys38/crtpf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
388
+ EOF
389
+ touch '$@'
390
+ endef
391
+
392
+ # Build System/38 logical file
393
+ define BUILD_LF38_TO_FILE
394
+ $(call SETUP_LOG,$(notdir $@))
395
+ $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
396
+ $(SSH) $(QSHELL) <<'EOF'
397
+ $(SET_LIBL)
398
+ system "qsys38/crtlf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
399
+ EOF
400
+ touch '$@'
401
+ endef
402
+
403
+ # Build System/38 printer file
404
+ define BUILD_PRTF38_TO_FILE
405
+ $(call SETUP_LOG,$(notdir $@))
406
+ $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
407
+ $(SSH) $(QSHELL) <<'EOF'
408
+ $(SET_LIBL)
409
+ system "qsys38/crtprtf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
410
+ EOF
411
+ touch '$@'
412
+ endef
413
+
370
414
  # Build SQL table
371
415
  define BUILD_SQLTABLE_TO_FILE
372
416
  $(call SETUP_LOG,$(notdir $@))
@@ -395,6 +439,26 @@ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call s
395
439
  touch '$@'
396
440
  endef
397
441
 
442
+ # Build SQL procedure as a service program.
443
+ # An SQL procedure whose source uses PROGRAM TYPE SUB is backed by a *SRVPGM.
444
+ # codermake only runs the SQL statement; IBM i creates the *SRVPGM and derives
445
+ # its object name from the routine (name it to match the target where practical).
446
+ define BUILD_SQLPROC_TO_SRVPGM
447
+ $(call SETUP_LOG,$(notdir $@))
448
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))")
449
+ touch '$@'
450
+ endef
451
+
452
+ # Build SQL UDF (CREATE FUNCTION ... LANGUAGE SQL) as a service program.
453
+ # SQL UDFs are backed by *SRVPGM objects. codermake only runs the SQL statement;
454
+ # IBM i creates the *SRVPGM and derives its object name from the routine (name it
455
+ # to match the target where practical).
456
+ define BUILD_SQLUDF_TO_SRVPGM
457
+ $(call SETUP_LOG,$(notdir $@))
458
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))")
459
+ touch '$@'
460
+ endef
461
+
398
462
  # Build message file from CL commands
399
463
  define BUILD_MSGF
400
464
  $(call SETUP_LOG,$(notdir $@))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profoundlogic/codermake",
3
- "version": "2.0.7",
3
+ "version": "2.1.0",
4
4
  "description": "Make wrapper framework for IBM i development that simplifies build rules",
5
5
  "main": "dist/bin/index.js",
6
6
  "type": "module",
@@ -155,6 +155,8 @@ ENDPGMEXP
155
155
  | `.clle` | `.module` | Module (*MODULE) | `CRTCLMOD` |
156
156
  | `.clp` / `.cl` | `.pgm` | Program (*PGM) | `CRTCLPGM` |
157
157
  | `.proc.sql` | `.pgm` | SQL Procedure (*PGM) | `RUNSQLSTM` |
158
+ | `.proc.sql` | `.srvpgm` | SQL Procedure (*SRVPGM, `PROGRAM TYPE SUB`) | `RUNSQLSTM` |
159
+ | `.udf.sql` | `.srvpgm` | SQL Function (*SRVPGM, `LANGUAGE SQL`) | `RUNSQLSTM` |
158
160
  | `.module` (1+) | `.pgm` | Program (*PGM) | `CRTPGM` |
159
161
  | `.module` + `.exports` or `.bnd` | `.srvpgm` | Service Program (*SRVPGM) | `CRTSRVPGM EXPORT(*SRCFILE)` |
160
162
  | `.module` (no exports) | `.srvpgm` | Service Program (*SRVPGM) | `CRTSRVPGM EXPORT(*ALL)` |
@@ -163,6 +165,10 @@ ENDPGMEXP
163
165
  | `.pf` | `.file` | Physical File (*FILE) | `CRTPF` |
164
166
  | `.lf` | `.file` | Logical File (*FILE) | `CRTLF` |
165
167
  | `.prtf` | `.file` | Printer File (*FILE) | `CRTPRTF` |
168
+ | `.dspf38` | `.file` | Display File (*FILE) | `QSYS38/CRTDSPF` (System/38, `DSPF38` member) |
169
+ | `.pf38` | `.file` | Physical File (*FILE) | `QSYS38/CRTPF` (System/38, `PF38` member) |
170
+ | `.lf38` | `.file` | Logical File (*FILE) | `QSYS38/CRTLF` (System/38, `LF38` member) |
171
+ | `.prtf38` | `.file` | Printer File (*FILE) | `QSYS38/CRTPRTF` (System/38, `PRTF38` member) |
166
172
  | `.table.sql` | `.file` | SQL Table (*FILE) | `RUNSQLSTM` |
167
173
  | `.index.sql` | `.file` | SQL Index (*FILE) | `RUNSQLSTM` |
168
174
  | `.view.sql` | `.file` | SQL View (*FILE) | `RUNSQLSTM` |
@@ -87,9 +87,9 @@ For ILE CL (`CRTBNDCL`, `CRTCLMOD`), the listing structure is similar to RPG --
87
87
 
88
88
  For OPM CL (`CRTCLPGM`), the output is typically shorter and errors reference source sequence numbers.
89
89
 
90
- ## DDS listings (.dspf, .pf, .lf, .prtf)
90
+ ## DDS listings (.dspf, .pf, .lf, .prtf, and their System/38 `.dspf38`/`.pf38`/`.lf38`/`.prtf38` variants)
91
91
 
92
- DDS compilation errors from `CRTDSPF`, `CRTPF`, `CRTLF`, or `CRTPRTF` produce `CPD` messages:
92
+ DDS compilation errors from `CRTDSPF`, `CRTPF`, `CRTLF`, or `CRTPRTF` produce `CPD` messages. The System/38 `.dspf38`, `.pf38`, `.lf38`, and `.prtf38` variants use the corresponding `QSYS38/...` commands.
93
93
 
94
94
  ```
95
95
  CPD7302 30 Record format SCREEN1 not found in file referenced.
@@ -98,7 +98,7 @@ CPD7344 30 Keyword REF not valid for this type of file.
98
98
 
99
99
  DDS errors typically reference a specific record format and line within the source.
100
100
 
101
- ## SQL DDL listings (.table.sql, .index.sql, .view.sql, .proc.sql)
101
+ ## SQL DDL listings (.table.sql, .index.sql, .view.sql, .proc.sql, .udf.sql)
102
102
 
103
103
  SQL DDL statements executed via `RUNSQLSTM` produce SQL messages:
104
104
 
@@ -110,6 +110,7 @@ SQL7905 10 Module *N in *N not found.
110
110
 
111
111
  - Severity 30+ means the statement failed.
112
112
  - Severity 20 warnings (like "already exists") may or may not be a problem depending on context.
113
+ - `.proc.sql` builds a `*PGM` (or a `*SRVPGM` with `PROGRAM TYPE SUB`) and `.udf.sql` builds a `*SRVPGM`; IBM i creates the object from the SQL routine, so the object name comes from the routine rather than the build target.
113
114
 
114
115
  ## Message files and binding directories (.msgf, .bnddir)
115
116
 
@@ -56,7 +56,7 @@ mypgm.pgm: mypgm.clp
56
56
 
57
57
  ### SQL procedure from .proc.sql
58
58
 
59
- Runs a SQL DDL script that creates a stored procedure. The resulting object appears as a program.
59
+ Runs a SQL DDL script that creates a stored procedure. With the default `PROGRAM TYPE MAIN`, the resulting object is a program (`*PGM`).
60
60
 
61
61
  ```makefile
62
62
  getcount.pgm: getcount.proc.sql
@@ -64,6 +64,8 @@ getcount.pgm: getcount.proc.sql
64
64
 
65
65
  **CL command:** `RUNSQLSTM SRCSTMF('src/getcount.proc.sql') COMMIT(*NONE) DFTRDBCOL(LIB)`
66
66
 
67
+ A `.proc.sql` whose routine uses `PROGRAM TYPE SUB`, and a `.udf.sql` SQL function, are backed by `*SRVPGM` objects instead — see [SQL service programs](#sql-service-programs-from-procsql--udfsql) under Service programs.
68
+
67
69
  ### Program from modules
68
70
 
69
71
  Links one or more compiled modules into a program. Prerequisites include `.module` targets, and optionally `.srvpgm` and `.bnddir` (normal or order-only) for automatic binding.
@@ -148,6 +150,22 @@ mysrvpgm.srvpgm: mymod.module mysrvpgm.exports dep.srvpgm
148
150
 
149
151
  This appends `BNDSRVPGM(DEP)` to the CRTSRVPGM command. `.bnddir` prerequisites (normal or order-only) append `BNDDIR(name)`.
150
152
 
153
+ ### SQL service programs from .proc.sql / .udf.sql
154
+
155
+ A service program can also be created from SQL source via `RUNSQLSTM`, with no modules or export list:
156
+
157
+ - **`.proc.sql` → `.srvpgm`** — `CREATE PROCEDURE ... LANGUAGE SQL PROGRAM TYPE SUB` is backed by a `*SRVPGM`.
158
+ - **`.udf.sql` → `.srvpgm`** — `CREATE FUNCTION ... LANGUAGE SQL` (SQL UDF) is backed by a `*SRVPGM`.
159
+
160
+ ```makefile
161
+ getcounts.srvpgm: getcounts.proc.sql employee.file # PROGRAM TYPE SUB
162
+ getname.srvpgm: getname.udf.sql employee.file # SQL UDF
163
+ ```
164
+
165
+ **CL command:** `RUNSQLSTM SRCSTMF('src/getcounts.proc.sql') COMMIT(*NONE) DFTRDBCOL(LIB)`
166
+
167
+ codermake only runs the SQL statement; IBM i creates the `*SRVPGM` and derives its object name from the SQL routine. Name the routine (and its `SPECIFIC` name where applicable) to match the build target so the generated object name lines up with the rule.
168
+
151
169
  ### .exports / .bnd file format
152
170
 
153
171
  The exports file (using either `.exports` or `.bnd` extension) is a plain text file with the following structure:
@@ -215,6 +233,25 @@ report.file: report.prtf
215
233
 
216
234
  **CL command:** `CRTPRTF FILE(LIB/REPORT) SRCFILE(LIB/QDDSSRC)`
217
235
 
236
+ ### System/38 compatible DDS (.pf38, .lf38, .dspf38, .prtf38)
237
+
238
+ System/38 compatible versions of `.pf`, `.lf`, `.dspf`, and `.prtf`. They build
239
+ through dedicated recipes that qualify the compile command from `QSYS38`. The
240
+ parameters currently match the base DDS recipes, but the commands are
241
+ `QSYS38/CRTPF`, `QSYS38/CRTLF`, `QSYS38/CRTDSPF`, and `QSYS38/CRTPRTF`. The
242
+ temporary source member's source type is derived from the file extension:
243
+ `.pf38` → `PF38`, `.lf38` → `LF38`, `.dspf38` → `DSPF38`, `.prtf38` → `PRTF38`.
244
+ Use these when a source member must retain its System/38 source type.
245
+
246
+ ```makefile
247
+ custp38.file: custp38.pf38 # QSYS38/CRTPF, PF38 member
248
+ custl38.file: custl38.lf38 custp38.file # QSYS38/CRTLF, LF38 member
249
+ hello38.file: hello38.dspf38 # QSYS38/CRTDSPF, DSPF38 member
250
+ rpt38.file: rpt38.prtf38 # QSYS38/CRTPRTF, PRTF38 member
251
+ ```
252
+
253
+ **CL commands:** `QSYS38/CRTPF` / `QSYS38/CRTLF` / `QSYS38/CRTDSPF` / `QSYS38/CRTPRTF`
254
+
218
255
  ### SQL table from .table.sql
219
256
 
220
257
  Creates a SQL table by running a DDL script.