Skip to content

Commit 27da600

Browse files
committed
Snippets for display file
Signed-off-by: Liam Allan <[email protected]>
1 parent 4424c79 commit 27da600

File tree

1 file changed

+102
-42
lines changed

1 file changed

+102
-42
lines changed

schemas/rpgle.code-snippets

Lines changed: 102 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
"endif;"
2323
]
2424
},
25-
"ifelse": {
25+
"ifelse": {
2626
"prefix": "ifelse",
2727
"description": "If else block",
2828
"body": [
2929
"if (${1});",
3030
" $0",
31-
"else;",
32-
" ",
31+
"else;",
32+
" ",
3333
"endif;"
3434
]
3535
},
@@ -60,7 +60,7 @@
6060
"endfor;"
6161
]
6262
},
63-
"foreach": {
63+
"foreach": {
6464
"prefix": "foreach",
6565
"description": "The FOR-EACH operation begins a group of operations to process the items in the array, sub-array, or %LIST one at a time.",
6666
"body": [
@@ -109,7 +109,7 @@
109109
"$0"
110110
]
111111
},
112-
"prototype": {
112+
"prototype": {
113113
"prefix": "dcl-pr",
114114
"body": [
115115
"dcl-pr $1 extpgm('$2');",
@@ -131,7 +131,7 @@
131131
],
132132
"description": "Create prototype for external program"
133133
},
134-
"subroutine": {
134+
"subroutine": {
135135
"prefix": "begsr",
136136
"body": [
137137
"begsr $1;",
@@ -140,7 +140,7 @@
140140
],
141141
"description": "Create subroutine."
142142
},
143-
"monitor": {
143+
"monitor": {
144144
"prefix": "monitor",
145145
"body": [
146146
"monitor;",
@@ -150,44 +150,105 @@
150150
],
151151
"description": "The monitor group performs conditional error handling based on the exception message or status code."
152152
},
153-
"snd-msg": {
153+
"snd-msg": {
154154
"prefix": "snd-msg",
155155
"body": [
156156
"snd-msg ${1|*INFO,*ESCAPE|} ${2:%TARGET(${3|*SELF,*CALLER,program-or-procedure|})) };"
157157
],
158158
"description": "The SND-MSG operation sends an informational message or an exception message. The message can be sent to any procedure on the call stack, including the current procedure. The message appears in the joblog after it is sent."
159159
},
160160
"sql-cursor-loop": {
161-
"prefix": "sql-cursor-loop",
162-
"description": "SQL cursor loop",
163-
"scope": "rpgle",
164-
"body": [
165-
"Dcl-Ds $3 ExtName('$3') Alias Qualified;",
166-
"End-Ds;",
167-
"",
168-
"EXEC SQL",
169-
" DECLARE $1 CURSOR FOR",
170-
" SELECT $2 FROM $3",
171-
" // WHERE field = :code",
172-
"EXEC SQL",
173-
" OPEN $1;",
174-
"--really should check SQLSTATE here too!",
175-
"",
176-
"EXEC SQL",
177-
" FETCH NEXT FROM $1 INTO $4;",
178-
"",
179-
"Dow SQLSTATE = '00000';",
180-
" --note 00000 = no errors or warning",
181-
" -- 02000 = no data",
182-
" <do somthing?>",
183-
" EXEC SQL",
184-
" FETCH NEXT FROM $1 INTO $4;",
185-
"ENDDO;",
186-
"",
187-
"EXEC SQL",
188-
" CLOSE $1;",
189-
]
190-
},
161+
"prefix": "sql-cursor-loop",
162+
"description": "SQL cursor loop",
163+
"scope": "rpgle",
164+
"body": [
165+
"Dcl-Ds $3 ExtName('$3') Alias Qualified;",
166+
"End-Ds;",
167+
"",
168+
"EXEC SQL",
169+
" DECLARE $1 CURSOR FOR",
170+
" SELECT $2 FROM $3",
171+
" // WHERE field = :code",
172+
"EXEC SQL",
173+
" OPEN $1;",
174+
"--really should check SQLSTATE here too!",
175+
"",
176+
"EXEC SQL",
177+
" FETCH NEXT FROM $1 INTO $4;",
178+
"",
179+
"Dow SQLSTATE = '00000';",
180+
" --note 00000 = no errors or warning",
181+
" -- 02000 = no data",
182+
" <do somthing?>",
183+
" EXEC SQL",
184+
" FETCH NEXT FROM $1 INTO $4;",
185+
"ENDDO;",
186+
"",
187+
"EXEC SQL",
188+
" CLOSE $1;",
189+
]
190+
},
191+
"workstation-basics": {
192+
"prefix": "workstation-basics",
193+
"description": "The basic definitions for a display file with a subfield",
194+
"scope": "rpgle",
195+
"body": [
196+
"Dcl-F ${1:displayfile} WORKSTN Sfile(SFLDta:Rrn) IndDS(WkStnInd) InfDS(fileinfo);",
197+
"",
198+
"Dcl-S Rrn Zoned(4:0) Inz;",
199+
"",
200+
"Dcl-DS WkStnInd;",
201+
" ProcessSCF Ind Pos(21);",
202+
" ReprintScf Ind Pos(22);",
203+
" Error Ind Pos(25);",
204+
" PageDown Ind Pos(30);",
205+
" PageUp Ind Pos(31);",
206+
" SflEnd Ind Pos(40);",
207+
" SflBegin Ind Pos(41);",
208+
" NoRecord Ind Pos(60);",
209+
" SflDspCtl Ind Pos(85);",
210+
" SflClr Ind Pos(75);",
211+
" SflDsp Ind Pos(95);",
212+
"End-DS;",
213+
"",
214+
"Dcl-DS FILEINFO;",
215+
" FUNKEY Char(1) Pos(369);",
216+
"End-DS;",
217+
]
218+
},
219+
"workstation-function-keys": {
220+
"prefix": "workstation-function-keys",
221+
"description": "Function key constants for display files",
222+
"scope": "rpgle",
223+
"body": [
224+
"Dcl-C F01 X'31';",
225+
"Dcl-C F02 X'32';",
226+
"Dcl-C F03 X'33';",
227+
"Dcl-C F04 X'34';",
228+
"Dcl-C F05 X'35';",
229+
"Dcl-C F06 X'36';",
230+
"Dcl-C F07 X'37';",
231+
"Dcl-C F08 X'38';",
232+
"Dcl-C F09 X'39';",
233+
"Dcl-C F10 X'3A';",
234+
"Dcl-C F11 X'3B';",
235+
"Dcl-C F12 X'3C';",
236+
"Dcl-C F13 X'B1';",
237+
"Dcl-C F14 X'B2';",
238+
"Dcl-C F15 X'B3';",
239+
"Dcl-C F16 X'B4';",
240+
"Dcl-C F17 X'B5';",
241+
"Dcl-C F18 X'B6';",
242+
"Dcl-C F19 X'B7';",
243+
"Dcl-C F20 X'B8';",
244+
"Dcl-C F21 X'B9';",
245+
"Dcl-C F22 X'BA';",
246+
"Dcl-C F24 X'BC';",
247+
"Dcl-C ENTER X'F1';",
248+
"Dcl-C HELP X'F3';",
249+
"Dcl-C PRINT X'F6';",
250+
]
251+
},
191252
"%abs": {
192253
"prefix": "%abs",
193254
"body": [
@@ -762,7 +823,6 @@
762823
],
763824
"description": "%STATUS returns the most recent value set for the program or file status."
764825
},
765-
766826
"%str": {
767827
"prefix": "%str",
768828
"body": [
@@ -968,7 +1028,7 @@
9681028
},
9691029
"Main": {
9701030
"prefix": "main",
971-
"body":[
1031+
"body": [
9721032
"**FREE",
9731033
"Ctl-Opt Main(${1:${TM_FILENAME_BASE/([^\\.]+).*/${1:/upcase}/}});",
9741034
"",
@@ -979,6 +1039,6 @@
9791039
" $0",
9801040
"End-Proc;"
9811041
],
982-
"description":"No cycle RPGLE program template"
983-
}
1042+
"description": "No cycle RPGLE program template"
1043+
}
9841044
}

0 commit comments

Comments
 (0)