Skip to content

Instantly share code, notes, and snippets.

View RainerRoss's full-sized avatar
🏠
Working from home

Rainer Ross RainerRoss

🏠
Working from home
  • Rainer Ross IT-Consulting
  • Munich, Germany
View GitHub Profile
@RainerRoss
RainerRoss / chatserver.js
Last active March 20, 2022 17:56
chat server
var express = require('/QOpenSys/QIBM/ProdData/Node/bin/node_modules/express');
var app = express();
var server = require('http').createServer(app);
var io = require('/QOpenSys/QIBM/ProdData/Node/bin/node_modules/socket.io').listen(server);
var conf = {"port": 8020};
app.use("/css", express.static(__dirname + '/css'));
app.get('/', function(request, response) {
response.sendfile(__dirname + '/html/index_chat.htm');
@RainerRoss
RainerRoss / writedata.js
Last active March 20, 2022 17:56
write data to DB/2
var db = require('/QOpenSys/QIBM/ProdData/Node/os400/db2i/lib/db2');
var chatdata = {
date : "2015-01-04",
time : "10:45:05",
user : "Rainer",
text : "this is a wonderful text"
};
function createString(data) {
@RainerRoss
RainerRoss / GETJSONIFS.SQLRPGLE
Last active December 28, 2023 14:48
Read JSON from IFS in RPGLE
ctl-opt dftactgrp(*no) option(*nodebugio:*nounref);
//------------------------------------------------------------------//
// //
// Get JSON from IFS //
// //
//----------------- //
// R.Ross 07.2018 * //
//------------------------------------------------------------------//
// Array SQL-Result //
//------------------------------------------------------------------//
ctl-opt main(main) dftactgrp(*no) option(*nounref);
//------------------------------------------------------------------//
// //
// Get Copper-Prices with HTTPGETCLOB //
// //
//----------------- //
// R.Ross 08.2018 * //
//------------------------------------------------------------------//
// Array XML-File - Das Rootelement quandl-response wird mit //
// Rsp (Response) abgekürzt: path=quandl-response //
//------------------------------------------------------------------//
// Create JSON-Status //
//------------------------------------------------------------------//
dcl-pr crtJSONStatus char(270) ccsid(*utf8) rtnparm;
PiSuccess varchar(05) const;
PiErrmsg char(256) const;
end-pr;
ctl-opt dftactgrp(*no) alloc(*teraspace) option(*nodebugio)
main(main) actgrp('UPLOAD') bnddir('WEBSRVUTL':'YAJL');
//------------------------------------------------------------------//
// //
// File Upload with Webix //
// //
//----------------- //
// R.Ross 09.2018 * //
//------------------------------------------------
ctl-opt dftactgrp(*no) actgrp('ADDME') pgminfo(*pcml:*module);
//------------------------------------------------------------------//
// SOAP-Webservice //
//------------------------------------------------------------------//
//------------------------------------------------------------------//
// Parameter //
//------------------------------------------------------------------//
dcl-pr addme;
ctl-opt dftactgrp(*no) alloc(*teraspace) option(*nodebugio:*nounref)
main(main) actgrp('GETXML') bnddir('WEBSRVUTL');
//------------------------------------------------------------------//
// //
// Get XMLInput from HTTP-Server and send XMLOutput to HTTP-Server //
// //
//----------------- //
// R.Ross 09.2018 * //
//------------------------------------------------
SELECT my_cube.rate_time, my_cube.currency, my_cube.rate
FROM
XMLTABLE(
-------------- Declare Namespaces ----------------------
XMLNAMESPACES(
DEFAULT 'http://www.ecb.int/vocabulary/2002-08-01/eurofxref',
'http://www.gesmes.org/xml/2002-08-01' AS "gesmes"
),
-------------- Row Expression --------------------------
'gesmes:Envelope/Cube/Cube/Cube'
ctl-opt dftactgrp(*no);
//------------------------------------------------------------------//
// //
// Einlesen einer CSV-Datei und Verarbeiten mit Split() //
// //
//----------------- //
// R.Ross 05.2019 * //
//------------------------------------------------------------------//
// SQL-Options //
//------------------------------------------------------------------//