Skip to content

Commit 90518c4

Browse files
authored
Merge pull request #1 from IBMiservices/writing
Writing
2 parents d98b587 + 9283dd6 commit 90518c4

35 files changed

+2038
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**/.deps
2+
**/.evfevent
3+
**/.logs
4+
**/.DS_Store
5+
**/Thumbs.db
6+
.project
7+
.env

.vscode/actions.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[
2+
{
3+
"extensions": [
4+
"GLOBAL"
5+
],
6+
"name": "Build all",
7+
"command": "OPT=*EVENTF BUILDLIB=&CURLIB /QOpenSys/pkgs/bin/makei build",
8+
"environment": "pase",
9+
"deployFirst": true,
10+
"postDownload": [
11+
".logs",
12+
".evfevent"
13+
]
14+
},
15+
{
16+
"extensions": [
17+
"GLOBAL"
18+
],
19+
"name": "Build current",
20+
"command": "OPT=*EVENTF BUILDLIB=&CURLIB /QOpenSys/pkgs/bin/makei compile -f &BASENAME",
21+
"environment": "pase",
22+
"deployFirst": true,
23+
"postDownload": [
24+
".logs",
25+
".evfevent"
26+
]
27+
}
28+
]

.vscode/tasks.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Install dependencies",
6+
"type": "shell",
7+
"command": "python",
8+
"args": ["install_deps.py"],
9+
"problemMatcher": []
10+
}
11+
]
12+
}

Rules.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SUBDIRS = core dep/messageutils/core dep/CommandsAPI/core

core/ADDPRINTSERVICES.BNDDIR

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* Have to delete the BNDDIR, or it will always be older than the source */
2+
/* because the CRTBNDDIR will fail the second time and only the ADDBNDDIRE is executed */
3+
!CRTBNDDIR BNDDIR(&O/SERVICES)
4+
ADDBNDDIRE BNDDIR(&O/SERVICES) OBJ((*LIBL/PRINT *SRVPGM))

core/PRINT.BND

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('V0.9.0')
2+
EXPORT SYMBOL(OpenSpool)
3+
EXPORT SYMBOL(WriteSpool)
4+
EXPORT SYMBOL(CloseSpool)
5+
ENDPGMEXP

core/Rules.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PRINT.MODULE: print.rpgle
2+
PRINT.SRVPGM: PRINT.BND PRINT.MODULE
3+
SERVICES.BNDDIR: ADDPRINTSERVICES.BNDDIR PRINT.SRVPGM

core/print.rpgle

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
**FREE
2+
Ctl-Opt NoMain Option(*SrcStmt : *NoDebugIO) Bnddir('SERVICES');
3+
4+
Dcl-F QSYSPRT PRINTER(132) usropn oflind(overflow);
5+
6+
/include 'PRINT.RPGLEINC'
7+
/include 'commands.RPGLEINC'
8+
9+
// // ============================================================
10+
// // Set up test suite. Executed once per RUCALLTST.
11+
// // ============================================================
12+
Dcl-proc setUpSpool export;
13+
Dcl-pi *n;
14+
spoolAInitialiser likeds(Spool);
15+
end-pi;
16+
17+
Dcl-s rc Char(1);
18+
19+
execCommand('OVRPRTF FILE(QSYSPRT) TOFILE(*FILE) +
20+
SPLFNAME(' + %trim(spoolAInitialiser.spoolName) + ') OVRSCOPE(*JOB)');
21+
monitor;
22+
OpenSpool();
23+
print('Executing: setUpSpool('+ %trim(spoolAInitialiser.spoolName) + ')');
24+
on-error;
25+
// ignore errors ...
26+
// ... but try to remove the override.
27+
monitor;
28+
execCommand('DLTOVR FILE(QSYSPRT) LVL(*JOB)');
29+
on-error;
30+
dsply '*** Failed to delete QSYSPRT override! ***' rc;
31+
endmon;
32+
endmon;
33+
34+
End-Proc;
35+
36+
// ============================================================
37+
// Ouvre le spool.
38+
// ============================================================
39+
Dcl-Proc OpenSpool export;
40+
Dcl-PI *N;
41+
End-PI;
42+
43+
open QSYSPRT;
44+
45+
End-Proc;
46+
47+
// ============================================================
48+
// Écrit un message dans le spool.
49+
// ============================================================
50+
Dcl-Proc WRITESPOOL export;
51+
Dcl-PI *N;
52+
MESSAGE CHAR(132) CONST;
53+
End-PI;
54+
55+
Dcl-DS lineOutput LEN(132) INZ;
56+
END-DS;
57+
58+
59+
lineOutput = %trim(MESSAGE);
60+
61+
write QSYSPRT lineOutput;
62+
63+
End-Proc;
64+
65+
// ============================================================
66+
// Ferme le spool.
67+
// ============================================================
68+
Dcl-Proc CloseSpool export;
69+
Dcl-PI *N;
70+
End-PI;
71+
72+
if (%open(QSYSPRT));
73+
close QSYSPRT;
74+
endif;
75+
76+
End-Proc;

dep/APIIBMi/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# API
2+
Gestion des API

dep/APIIBMi/Rules.mk

Whitespace-only changes.

0 commit comments

Comments
 (0)