@sasjs/core 4.32.0 → 4.32.1

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.
@@ -4,8 +4,8 @@
4
4
  @details Reads in a file byte by byte and writes it back out. Is an
5
5
  os-independent method to copy files. In case of naming collision, the
6
6
  default filerefs can be modified.
7
- Based on:
8
- https://stackoverflow.com/questions/13046116/using-sas-to-copy-a-text-file
7
+ Note that if you have a new enough version of SAS, and you don't need features
8
+ such as APPEND, you may be better of using the fcopy() function instead.
9
9
 
10
10
  %mp_binarycopy(inloc="/home/me/blah.txt", outref=_webout)
11
11
 
@@ -45,14 +45,9 @@
45
45
  ,outref=____out /* override default to use own filerefs */
46
46
  ,mode=CREATE
47
47
  )/*/STORE SOURCE*/;
48
- %local mod outmode;
49
- %if &mode=APPEND %then %do;
50
- %let mod=mod;
51
- %let outmode='a';
52
- %end;
53
- %else %do;
54
- %let outmode='o';
55
- %end;
48
+ %local mod;
49
+ %if &mode=APPEND %then %let mod=mod;
50
+
56
51
  /* these IN and OUT filerefs can point to anything */
57
52
  %if &inref = ____in %then %do;
58
53
  filename &inref &inloc lrecl=1048576 ;
@@ -63,22 +58,17 @@
63
58
 
64
59
  /* copy the file byte-for-byte */
65
60
  data _null_;
66
- length filein 8 fileid 8;
67
- filein = fopen("&inref",'I',1,'B');
68
- fileid = fopen("&outref",&outmode,1,'B');
69
- rec = '20'x;
70
- do while(fread(filein)=0);
71
- rc = fget(filein,rec,1);
72
- rc = fput(fileid, rec);
73
- rc =fwrite(fileid);
74
- end;
75
- rc = fclose(filein);
76
- rc = fclose(fileid);
61
+ infile &inref lrecl=1 recfm=n;
62
+ file &outref &mod recfm=n;
63
+ input sourcechar $char1. @@;
64
+ format sourcechar hex2.;
65
+ put sourcechar char1. @@;
77
66
  run;
67
+
78
68
  %if &inref = ____in %then %do;
79
69
  filename &inref clear;
80
70
  %end;
81
71
  %if &outref=____out %then %do;
82
72
  filename &outref clear;
83
73
  %end;
84
- %mend mp_binarycopy;
74
+ %mend mp_binarycopy;
@@ -234,22 +234,18 @@
234
234
  "&&name&i"n /* name literal for reserved variable names */
235
235
  %end;
236
236
  %if &action=ARR %then "]" ; %else "}" ; ;
237
- /* now write the long strings to _webout 1 byte at a time */
237
+ /* now write the long strings to _webout 1 char at a time */
238
238
  data _null_;
239
- length filein 8 fileid 8;
240
- filein=fopen("_sjs",'I',1,'B');
241
- fileid=fopen("&jref",'A',1,'B');
242
- rec='20'x;
243
- do while(fread(filein)=0);
244
- rc=fget(filein,rec,1);
245
- rc=fput(fileid, rec);
246
- rc=fwrite(fileid);
247
- end;
248
- /* close out the table */
249
- rc=fput(fileid, "]");
250
- rc=fwrite(fileid);
251
- rc=fclose(filein);
252
- rc=fclose(fileid);
239
+ infile _sjs lrecl=1 recfm=n;
240
+ file &jref mod lrecl=1 recfm=n;
241
+ input sourcechar $char1. @@;
242
+ format sourcechar hex2.;
243
+ put sourcechar char1. @@;
244
+ run;
245
+ /* close out the table */
246
+ data _null_;
247
+ file &jref mod;
248
+ put ']';
253
249
  run;
254
250
  filename _sjs clear;
255
251
  %end;
@@ -17,7 +17,7 @@
17
17
  %mm_createfolder(path=/some/meta/folder)
18
18
 
19
19
  @param [in] path= Name of the folder to create.
20
- @param [in] mdebug= set DBG to 1 to disable DEBUG messages
20
+ @param [in] mdebug= (0) Set to 1 to enable DEBUG messages
21
21
 
22
22
 
23
23
  @version 9.4
@@ -2,7 +2,8 @@
2
2
  @file mm_createwebservice.sas
3
3
  @brief Create a Web Ready Stored Process
4
4
  @details This macro creates a Type 2 Stored Process with the mm_webout macro
5
- included as pre-code.
5
+ (and dependencies) included as pre-code.
6
+
6
7
  Usage:
7
8
 
8
9
  %* compile macros ;
@@ -267,22 +268,18 @@ data _null_;
267
268
  put ' "&&name&i"n /* name literal for reserved variable names */ ';
268
269
  put ' %end; ';
269
270
  put ' %if &action=ARR %then "]" ; %else "}" ; ; ';
270
- put ' /* now write the long strings to _webout 1 byte at a time */ ';
271
+ put ' /* now write the long strings to _webout 1 char at a time */ ';
271
272
  put ' data _null_; ';
272
- put ' length filein 8 fileid 8; ';
273
- put ' filein=fopen("_sjs",''I'',1,''B''); ';
274
- put ' fileid=fopen("&jref",''A'',1,''B''); ';
275
- put ' rec=''20''x; ';
276
- put ' do while(fread(filein)=0); ';
277
- put ' rc=fget(filein,rec,1); ';
278
- put ' rc=fput(fileid, rec); ';
279
- put ' rc=fwrite(fileid); ';
280
- put ' end; ';
281
- put ' /* close out the table */ ';
282
- put ' rc=fput(fileid, "]"); ';
283
- put ' rc=fwrite(fileid); ';
284
- put ' rc=fclose(filein); ';
285
- put ' rc=fclose(fileid); ';
273
+ put ' infile _sjs lrecl=1 recfm=n; ';
274
+ put ' file &jref mod lrecl=1 recfm=n; ';
275
+ put ' input sourcechar $char1. @@; ';
276
+ put ' format sourcechar hex2.; ';
277
+ put ' put sourcechar char1. @@; ';
278
+ put ' run; ';
279
+ put ' /* close out the table */ ';
280
+ put ' data _null_; ';
281
+ put ' file &jref mod; ';
282
+ put ' put '']''; ';
286
283
  put ' run; ';
287
284
  put ' filename _sjs clear; ';
288
285
  put ' %end; ';
@@ -494,7 +491,7 @@ run;
494
491
  %if &x>1 %then %let mod=mod;
495
492
 
496
493
  %let fref=%scan(&freflist,&x);
497
- %put &sysmacroname: adding &fref;
494
+ %&mD.put &sysmacroname: adding &fref;
498
495
  data _null_;
499
496
  file "&work/&tmpfile" lrecl=3000 &mod;
500
497
  infile &fref;
@@ -530,12 +527,10 @@ data _null_;
530
527
  if rc=0 then call symputx('url',url,'l');
531
528
  run;
532
529
 
533
- %put ;%put ;%put ;%put ;%put ;%put ;
534
530
  %put &sysmacroname: STP &name successfully created in &path;
535
- %put ;%put ;%put ;
536
531
  %put Check it out here:;
537
532
  %put ;%put ;%put ;
538
533
  %put &url?_PROGRAM=&path/&name;
539
- %put ;%put ;%put ;%put ;%put ;%put ;
534
+ %put ;%put ;%put ;
540
535
 
541
536
  %mend mm_createwebservice;
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "@sasjs/cli": "3.13.0"
37
37
  },
38
- "version": "4.32.0"
38
+ "version": "4.32.1"
39
39
  }
@@ -269,22 +269,18 @@ data _null_;
269
269
  put ' "&&name&i"n /* name literal for reserved variable names */ ';
270
270
  put ' %end; ';
271
271
  put ' %if &action=ARR %then "]" ; %else "}" ; ; ';
272
- put ' /* now write the long strings to _webout 1 byte at a time */ ';
272
+ put ' /* now write the long strings to _webout 1 char at a time */ ';
273
273
  put ' data _null_; ';
274
- put ' length filein 8 fileid 8; ';
275
- put ' filein=fopen("_sjs",''I'',1,''B''); ';
276
- put ' fileid=fopen("&jref",''A'',1,''B''); ';
277
- put ' rec=''20''x; ';
278
- put ' do while(fread(filein)=0); ';
279
- put ' rc=fget(filein,rec,1); ';
280
- put ' rc=fput(fileid, rec); ';
281
- put ' rc=fwrite(fileid); ';
282
- put ' end; ';
283
- put ' /* close out the table */ ';
284
- put ' rc=fput(fileid, "]"); ';
285
- put ' rc=fwrite(fileid); ';
286
- put ' rc=fclose(filein); ';
287
- put ' rc=fclose(fileid); ';
274
+ put ' infile _sjs lrecl=1 recfm=n; ';
275
+ put ' file &jref mod lrecl=1 recfm=n; ';
276
+ put ' input sourcechar $char1. @@; ';
277
+ put ' format sourcechar hex2.; ';
278
+ put ' put sourcechar char1. @@; ';
279
+ put ' run; ';
280
+ put ' /* close out the table */ ';
281
+ put ' data _null_; ';
282
+ put ' file &jref mod; ';
283
+ put ' put '']''; ';
288
284
  put ' run; ';
289
285
  put ' filename _sjs clear; ';
290
286
  put ' %end; ';
@@ -411,22 +411,18 @@ data _null_;
411
411
  put ' "&&name&i"n /* name literal for reserved variable names */ ';
412
412
  put ' %end; ';
413
413
  put ' %if &action=ARR %then "]" ; %else "}" ; ; ';
414
- put ' /* now write the long strings to _webout 1 byte at a time */ ';
414
+ put ' /* now write the long strings to _webout 1 char at a time */ ';
415
415
  put ' data _null_; ';
416
- put ' length filein 8 fileid 8; ';
417
- put ' filein=fopen("_sjs",''I'',1,''B''); ';
418
- put ' fileid=fopen("&jref",''A'',1,''B''); ';
419
- put ' rec=''20''x; ';
420
- put ' do while(fread(filein)=0); ';
421
- put ' rc=fget(filein,rec,1); ';
422
- put ' rc=fput(fileid, rec); ';
423
- put ' rc=fwrite(fileid); ';
424
- put ' end; ';
425
- put ' /* close out the table */ ';
426
- put ' rc=fput(fileid, "]"); ';
427
- put ' rc=fwrite(fileid); ';
428
- put ' rc=fclose(filein); ';
429
- put ' rc=fclose(fileid); ';
416
+ put ' infile _sjs lrecl=1 recfm=n; ';
417
+ put ' file &jref mod lrecl=1 recfm=n; ';
418
+ put ' input sourcechar $char1. @@; ';
419
+ put ' format sourcechar hex2.; ';
420
+ put ' put sourcechar char1. @@; ';
421
+ put ' run; ';
422
+ put ' /* close out the table */ ';
423
+ put ' data _null_; ';
424
+ put ' file &jref mod; ';
425
+ put ' put '']''; ';
430
426
  put ' run; ';
431
427
  put ' filename _sjs clear; ';
432
428
  put ' %end; ';