Jump to content
Sign in to follow this  

Need help on JavaScripting

Recommended Posts

I do not know Javascript. I know some Java but mostly I am a mainframe coding programmer. I am working on an issue at work. We are processing Sybase database deployments. The scripts come in as txt files with 1 txt file containing 1 deployment. During the deployment a log file is generated which is displayed below. The log file can determine what has been processed and what has been error out. I have some code below that I believe puts the line information in a array. I need to determine what script processed successfully and what script errored out. I then need to out put both files to txt or sql files. If 10 scripts were processed and script 5 err out theprocessed output file would have to be in the format of 

The error output file would have 

The code below does not extract the file name and its only a start.

properties.put("Status", "Success");

if (properties.get("exitCode") != 0) {
properties.put("Status", "Failure");
else {
var line= ' ' 
scanner.register("(?i)Fail to Exeute", function(lineNumber, line) {
var errors = properties.get("Fail");
if (errors == null) {
errors = new java.util.ArrayList();
properties.put("Status", "Failure");
var processed = properties.get("Executing Resource");
if (processed == null) {
processed = new java.util.ArrayList();
var errors = properties.get("Error");
if (errors == null) {
errors = new java.util.ArrayList();
properties.put("Error", errors.toString());
var processed = properties.get("Executing Resource");
if (processed == null) {
processed = new java.util.ArrayList();
properties.put("Executing Resource", processed.toString());

LOG FILE (There is a line number sequence on the left that did not copy)

Executing resource: /var/serena/work/VAN_Sybase/sybase7.txt   (this script was a success)2 [sql] ,3 [sql] pass 3,244 [sql] 0 rows affected5 [sql] Failed to execute: 'pass 1', @@servername, db_name(), getdate() 6 [sql] Executing resource: /var/serena/work/VAN_Sybase/sybase8.txt  (this script errred out)7Error Executing SQL Scripts: com.sybase.jdbc4.jdbc.SybSQLException: Incorrect syntax near','.

So I would need 1 file containing


and 1 file containing


Any help on this would be awesome. thanks!!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...