Skip to content

Commit 611eb46

Browse files
committed
V2."=
MonAS400msgq Added opportunity to change the default sts and sev in the MonAS400msgq.csv file CpyAS400TblToSQLsvr Added new pgm to copy AS400 tables from AS400 to SQL server.
1 parent 36ada92 commit 611eb46

File tree

9 files changed

+425
-21
lines changed

9 files changed

+425
-21
lines changed

CpyAS400TblToSQLsvr.java

Lines changed: 387 additions & 0 deletions
Large diffs are not rendered by default.

Jvakt.jar

1.39 MB
Binary file not shown.

Message.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,19 @@ public boolean setBody( String body ) {
4646
// if (body == null) { body = " "; }
4747
if (body.length() > 255) body = body.substring(0, 255);
4848
body = body.replaceAll("\\\\" , "/");
49-
// body = body.replaceAll("[^a-zA-Z0-9:;_%@#/><åäöÅÄÖ\"\\,\\.\\!\\?\\*\\$\\)\\(\\-\\=\\{\\}\\]\\[]" , " ");
49+
body = body.replaceAll("å" , "a");
50+
body = body.replaceAll("ä" , "a");
51+
body = body.replaceAll("ö" , "o");
52+
body = body.replaceAll("Å" , "A");
53+
body = body.replaceAll("Ä" , "A");
54+
body = body.replaceAll("Ö" , "O");
5055
body = body.replaceAll("[^a-zA-Z0-9:;_%@#/><\"\\,\\.\\!\\?\\*\\$\\)\\(\\-\\=\\{\\}\\]\\[]" , " ");
5156
body = body.replaceAll(" {2,}", " "); // replace multiple spaces with one
5257
body = body.trim();
5358
String[] tab = body.split("<;>",2);
5459
this.body = tab[0];
55-
// System.out.println("Body length>> " + this.body.length());
56-
// System.out.println("Body>> " + this.body);
60+
// System.out.println("Body length>> " + this.body.length());
61+
// System.out.println("Body>> " + this.body);
5762
return true;
5863
}
5964
public boolean setAgent( String agent ) {

MonAS400msgq.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package Jvakt;
22
/*
3+
* 2024-05-09 V.56 Michael Ekdal Added opportunity to change the default sts and sev in the MonAS400msgq.csv file
34
* 2022-11-15 V.55 Michael Ekdal Fixed: When -dormant, "All reports will be forced to be 30 or higher"
45
* 2022-11-15 V.55 Michael Ekdal Tested: Used with Java 17.
56
* 2022-06-23 V.54 Michael Ekdal Added getVersion() to get at consistent version throughout all classes.
@@ -29,7 +30,7 @@ public class MonAS400msgq {
2930
public static void main(String[] args) throws IOException {
3031

3132
now = new Date();
32-
String version = getVersion()+".55";
33+
String version = getVersion()+".56";
3334

3435
// Displays help
3536
if (args.length == 0) {
@@ -40,7 +41,7 @@ public static void main(String[] args) throws IOException {
4041
"\n-ah \tHostname of the AS400 server."+
4142
"\n-us \tThe AS400 user."+
4243
"\n-pw \tThe AS400 password."+
43-
"\n-config \tThe dir of the input files. Like: \"-config c:\\Temp\" "+
44+
"\n-config \tThe dir of the input files. Like: \"-config c:\\Temp\" (MonAS400msgq.csv must be present) "+
4445
"\n-jh \tHostname of the Jvakt server."+
4546
"\n-jp \tThe port of the Jvakt server."+
4647
"\n-dormant \tAll reports will be forced to be 30 or higher. No autoreply will be made.");
@@ -69,6 +70,8 @@ public static void main(String[] args) throws IOException {
6970
String s = "";
7071
boolean swAutoreply = false;
7172
boolean swDormant = false;
73+
int sevDefault = 1;
74+
String stsDefault = "ERR";
7275
int sev;
7376
String sts;
7477
// Enumeration<QueuedMessage> q = null;
@@ -116,10 +119,15 @@ public static void main(String[] args) throws IOException {
116119
if (s.startsWith("#")) continue;
117120
if (s.length() == 0) continue;
118121
Ftab[ecount++] = s.toUpperCase();
119-
// System.out.println( Ftab[ecount - 1]);
122+
words = s.toUpperCase().split(";",4);
123+
if (words[0].startsWith("*")) {
124+
sevDefault = Integer.parseInt(words[1]);
125+
stsDefault = words[2];
126+
}
120127
}
121128
inokay.close();
122129
System.out.println(" Imported "+ecount+" rows from "+configF);
130+
System.out.println(" Default values for unhandled messages are "+sevDefault+" and "+stsDefault);
123131
if (swDormant) System.out.println(" Dormant mode on");
124132
// System.out.println( " count: " + ecount);
125133

@@ -163,8 +171,8 @@ public static void main(String[] args) throws IOException {
163171
sts = "INFO";
164172
}
165173
else {
166-
sev = 1;
167-
sts = "ERR";
174+
sev = sevDefault;
175+
sts = stsDefault;
168176
}
169177
rpy = "";
170178
swAutoreply = false;

RptToJv.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class RptToJv
77
{
88
public static void Main(string[] args)
99
{
10-
string version = "RptToJv C# (2020-NOV-20)";
10+
string version = "RptToJv C# (2024-APR-03)";
1111
string host = "127.0.0.1";
1212
int port = 1956;
1313
string id = null;
@@ -74,7 +74,7 @@ public static void Main(string[] args)
7474
if (args.Length < 1 || string.ReferenceEquals(id, null))
7575
{
7676
Console.WriteLine("\n\n- "+version);
77-
Console.WriteLine("- by Michael Ekdal Perstorp Sweden.\n");
77+
Console.WriteLine("- by Michael Ekdal, Sweden.\n");
7878
Console.WriteLine("-host \t - default is 127.0.0.1");
7979
Console.WriteLine("-port \t - default is 1956");
8080
Console.WriteLine("-id ");
@@ -189,7 +189,6 @@ public virtual bool setRptsts(string rptsts)
189189
{
190190
rptsts = rptsts.Substring(0, 255);
191191
}
192-
//rptsts = rptsts.replaceAll("[^a-zA-Z]", "");
193192
string[] separatingStrings = { "<;>" };
194193
string[] tab = rptsts.Split(separatingStrings, System.StringSplitOptions.RemoveEmptyEntries);
195194
this.rptsts = tab[0];
@@ -209,17 +208,18 @@ public virtual bool setRptsts(string rptsts)
209208
}
210209
public virtual bool setBody(string body)
211210
{
212-
// regex metacharacters: <([{\^-=$!|]})?*+.>
213211
body = body.Trim();
214212
if (body.Length > 255)
215213
{
216214
body = body.Substring(0, 255);
217215
}
218216
if (body.Length == 0) body = " ";
219-
//body = body.replaceAll("\\\\", "/");
220-
//body = body.replaceAll("[^a-zA-Z0-9:;_#/><åäöÅÄÖ\"\\,\\.\\!\\?\\*\\$\\)\\(\\-\\=\\{\\}\\]\\[]", " ");
221-
//body = body.replaceAll(" {2,}", " "); // replace multiple spaces with one
222-
//string[] tab = body.Split("<;>", 2);
217+
body = body.Replace('å', 'a');
218+
body = body.Replace('ä', 'a');
219+
body = body.Replace('ö', 'o');
220+
body = body.Replace('Å', 'A');
221+
body = body.Replace('Ä', 'A');
222+
body = body.Replace('Ö', 'O');
223223

224224
string[] separatingStrings = { "<;>" };
225225
string[] tab = body.Split(separatingStrings, System.StringSplitOptions.RemoveEmptyEntries);
@@ -234,9 +234,6 @@ public virtual bool setAgent(string agent)
234234
{
235235
agent = agent.Substring(0, 255);
236236
}
237-
//agent = agent.replaceAll("[^a-zA-Z0-9.:!?;*_$#)(//\"><-=]", " ");
238-
//string[] tab = agent.Split("<;>", 2);
239-
//this.agent = tab[0];
240237
string[] separatingStrings = { "<;>" };
241238
string[] tab = agent.Split(separatingStrings, System.StringSplitOptions.RemoveEmptyEntries);
242239
this.agent = tab[0];

RptToJv.exe

0 Bytes
Binary file not shown.

SendMsg.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class SendMsg
2020

2121
int port;
2222
byte[] bytes = new byte[1024];
23-
private const string version = "SendMsg C# 2020-SEP-12\r\n";
23+
private const string version = "SendMsg C# 2024-APR-03\r\n";
2424

2525
public SendMsg(string host, int port)
2626
{

Version.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
*/
77

88
/*
9+
* 2024-05-09 V2.20 Michael Ekdal MonAS400msgq Added opportunity to change the default sts and sev in the MonAS400msgq.csv file
10+
* 2024-05-09 V2.20 Michael Ekdal CpyAS400TblToSQLsvr Added new pgm to copy AS400 tables from AS400 to SQL server.
911
* 2024-02-24 V2.19 Michael Ekdal DBUpdate,CheckStatus Added logic to restrict number of messages per ID in the console
1012
* 2023-11-25 V2.18 Michael Ekdal CheckLogs Added a function to import logs file into the Jvakt database.
1113
* 2023-10-25 V2.17 Michael Ekdal CheckLogs If there is at least a must line the program is not aborted.
@@ -26,7 +28,7 @@
2628

2729
public class Version {
2830

29-
static private String version = "2.19";
31+
static private String version = "2.20";
3032

3133
public boolean isVersionOk() { return true; }
3234

monAS400msgq.csv.sample

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
#
33
# Searchstring ; jvakt prio (X is exclude) ; jvakt type ; reply
44

5+
# Default values (Default in program are 1 and ERR)
6+
# *;30;INFO
7+
8+
59
## Autoanswers
610
#CPA0701 &3 RECEIVED BY &1 AT &4. (C D I R)
711
CPA0701 MCH1211;30;INFO;D
@@ -123,6 +127,7 @@ EDH30;30;INFO
123127
CPF1393;30;INFO
124128
CPF1817;30;INFO
125129
CPI0973;30;INFO
130+
CPC1604;30;INFO
126131
running okay;30;INFO
127132
is mounted;30;INFO
128133
Autoanswer:;30;INFO

0 commit comments

Comments
 (0)