DATEADJ to ReadMe & Misc

This commit is contained in:
SJLennon 2024-05-09 11:46:31 -04:00
parent 21917dda6e
commit 0279066993
4 changed files with 97 additions and 8 deletions

74
.vscode/actions.json vendored Normal file
View File

@ -0,0 +1,74 @@
[
{
"name": "Create RPGLE Program",
"command": "CRTBNDRPG PGM(&CURLIB/&NAME) SRCSTMF('&RELATIVEPATH') OPTION(*EVENTF) DBGVIEW(*SOURCE) TGTCCSID(*JOB)",
"deployFirst": true,
"environment": "ile",
"extensions": [
"RPGLE"
]
},
{
"name": "Create RPGLE Module",
"command": "CRTRPGMOD MODULE(&CURLIB/&NAME) SRCSTMF('&RELATIVEPATH') OPTION(*EVENTF) DBGVIEW(*SOURCE) TGTCCSID(*JOB)",
"deployFirst": true,
"environment": "ile",
"extensions": [
"RPGLE"
]
},
{
"name": "Create SQLRPGLE Program",
"command": "CRTSQLRPGI OBJ(&CURLIB/&NAME) SRCSTMF('&RELATIVEPATH') OPTION(*EVENTF) DBGVIEW(*SOURCE) CLOSQLCSR(*ENDMOD) CVTCCSID(*JOB) COMPILEOPT('TGTCCSID(*JOB)') RPGPPOPT(*LVL2)",
"deployFirst": true,
"environment": "ile",
"extensions": [
"SQLRPGLE"
]
},
{
"name": "Create SQLRPGLE Module",
"command": "CRTSQLRPGI OBJ(&CURLIB/&NAME) SRCSTMF('&RELATIVEPATH') OBJTYPE(*MODULE) OPTION(*EVENTF) DBGVIEW(*SOURCE) CLOSQLCSR(*ENDMOD) CVTCCSID(*JOB) COMPILEOPT('TGTCCSID(*JOB)') RPGPPOPT(*LVL2)",
"deployFirst": true,
"environment": "ile",
"extensions": [
"SQLRPGLE"
]
},
{
"extensions": [
"CLP",
"CLLE"
],
"name": "Create Bound CL Program",
"command": "CRTBNDCL PGM(&CURLIB/&NAME) SRCSTMF('&RELATIVEPATH') OPTION(*EVENTF) DBGVIEW(*SOURCE)",
"deployFirst": true,
"environment": "ile"
},
{
"extensions": [
"cmd"
],
"name": "Create Command",
"command": "CRTCMD CMD(&CURLIB/&NAME) PGM(&CURLIB/&NAME) SRCSTMF('&RELATIVEPATH') OPTION(*EVENTF)",
"deployFirst": true,
"environment": "ile"
},
{
"extensions": [
"SQL",
"TABLE",
"VIEW",
"SQLPRC",
"SQLUDF",
"SQLUDT",
"SQLTRG",
"SQLALIAS",
"SQLSEQ"
],
"name": "Run SQL Statements (RUNSQLSTM)",
"command": "RUNSQLSTM SRCSTMF('&FULLPATH') COMMIT(*NONE) NAMING(*SQL)",
"deployFirst": true,
"environment": "ile"
}
]

View File

@ -60,6 +60,10 @@ Many shops are still using 5250 "green screen" applications and these need to be
A service program to add 1 to an alpha-numeric string of any length.
## DATEADJ
A command to add or subtract from a date in a CL program
## DATE_UDF
SQL User Defined Functions to convert legacy dates to true dates. Written in RPG.

View File

@ -20,6 +20,10 @@
// input and output, but it doesn't have to be the same memory
// in the caller. Use copy member USAdrValDS.
//====================================================================
// 04/2024 LENNON
// Change to HTTPS
// Provide password, even though it currently seems to be ignored.
//====================================================================
ctl-opt
nomain
@ -35,7 +39,10 @@ ctl-opt
// === Data area containing your USPS supplied User id. ==============
// (The USPS supplied USER ID length is not clear, so I made it
// longer than the 12-char one supplied to me..)
dcl-ds USPS_ID dtaara len(20) qualified;
// Ditto for password, though password seems to be ignored.
dcl-ds USPS_ID dtaara len(20) qualified;
end-ds;
dcl-ds USPS_PWD dtaara len(20) qualified;
end-ds;
//=== USAdrVal =======================================================
@ -54,20 +61,24 @@ dcl-proc USAdrVal export;
dcl-ds po likeds(USAdrValDS);
dcl-s ID varchar(20);
// Get USPS UserID.
dcl-s PWD varchar(20);
// Get USPS UserID & Password
in USPS_ID;
ID = %trim(USPS_ID);
in USPS_PWD;
PWD = %trim(USPS_PWD);
clear po;
// Call USPS Address Validate API. It returns an XML document.
exec sql
values QSYS2.HTTP_GET(
'http://production.shippingapis.com/ShippingAPI.dll'
'https://secure.shippingapis.com/ShippingAPI.dll'
concat '?API=Verify&XML=' concat
url_encode(
'<AddressValidateRequest ' concat
'USERID="' concat :ID concat '">' concat
'<AddressValidateRequest ' concat
'USERID="' concat :ID concat '"'
concat ' PASSWORD="' concat :PWD concat '">' concat
'<Revision>1</Revision>' concat
'<Address ID="0">' concat
'<Address1>' concat :pi.Address1 concat '</Address1>' concat
@ -77,7 +88,7 @@ dcl-proc USAdrVal export;
'<Zip5>' concat :pi.Zip5 concat '</Zip5>' concat
'<Zip4>' concat :pi.Zip4 concat '</Zip4>' concat
'</Address>' concat
'</AddressValidateRequest>'
'</AddressValidateRequest>'
)
) into :retXML;
if (SQLSTATE <> SQLSUCCESS);

View File

@ -1,6 +1,6 @@
**free
ctl-opt debug option(*nodebugio: *srcstmt)
dftactgrp(*no) actgrp(*caller)
dftactgrp(*no) actgrp('USPS')
bnddir('UTIL_BND':'SQL_BND':'ADRVAL_BND')
main(Main);
//====================================================================
@ -83,7 +83,7 @@ dcl-proc Main;
return;
end-proc Main;
//=== Routine to print input and outpur side by side =================
//=== Routine to print input and output side by side =================
dcl-proc DspAdr;
dcl-pi DspAdr;
pi likeds(USAdrValDS);