 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
Greg Johnson
Joined: 20 Oct 2001 Posts: 26
|
|
JobModify statement & large JAL scripts |
|
I am trying to dynamically create a job that contains a large JAL script using another job with JAL scripting. I am using the JobModify statement but have not been able to get the entire script into the dynamically created job. Here is a sample of the code I am using. Is there any way to do this using JAL? This example only creates a portion of the JAL code in the dynamically created job. Note that I changed the escape character to be the ^ symbol. The dynamic JAL in this example is only a portion of what I am trying to create. JobCreate( NewJobNumber ) JobModify( NewJobNumber, "name", "Built Job 2" ) JobModify( NewJobNumber, "job_type", "s" ) JobModify( NewJobNumber, "schedule_type", "x") JobModify( NewJobNumber, "script_type", "JAL" ) JobModify( NewJobNumber, "script", " & // declare the global variables ^n & // ***************************************** ^n & // *** DB2 STOP Instance *** ^n & // ***************************************** ^n & ^n & // declare the global variables ^n & Dim DB2_InstanceName, string, ^"DB2^" ^n & Dim DB2_DoNotSetInstance, boolean, False ^n & ^n & Dim JS_DriveLetter, string ^n & Left( @V^"24x7_home^", 1, JS_DriveLetter ) ^n & Dim JS_Dir, string, ^"job_scripts^" ^n & Dim JS_ScriptFilePathNoExt, string ^n & Dim JS_ScriptFileExtension, string, ^"cmd^" ^n & Dim JS_LogFileExtension, string, ^"log^" ^n & Dim JS_SQLFileExtension, string, ^"sql^" ^n & Dim MISC_JobTimeOut, number, 30 ^n & ^n & Dim JS_File_Name,string, ^"db2stop^" ^n & ConcatEx (JS_DriveLetter, ^":\\^", JS_Dir, ^"\\^", DB2_InstanceName, ^"_^", JS_File_Name, JS_ScriptFilePathNoExt) ^n & ^n & Exit " ) Thanks, Greg
|
|
Tue Apr 30, 2002 9:54 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
Re: JobModify statement & large JAL scripts |
|
String constants cannot spawn multiple lines, in other words the line continuatiion symbol "&" cannot be used withing hard-coded strings for text continuation. You have two options: First is to do evering in a script using Concat or ConcatEx statements Example: Dim( MyScript, string ) Concat( MyScript, "// declare the global variables ^n", MyScript ) Concat( MyScript, "Dim DB2_InstanceName, string, ^"DB2^" ^n", MyScript ) Concat( MyScript, "Dim DB2_DoNotSetInstance, boolean, False ^n", MyScript ) ... and so on JobModify( NewJobNumber, "script", MyScript ) Second option is to write the script line by line to a temp file then read it back using FileReadAll Example: Dim( FileNo, number ) FileOpen( "temp.tmp", "LineMode", "Write", False, FileNo ) FileWrite( FileNo, "// declare the global variables" ) FileWrite( FileNo, "Dim DB2_InstanceName, string, ^"DB2^"" ) FileWrite( FileNo, "Dim DB2_DoNotSetInstance, boolean, False " ) ... and so on FileReadAll( "temp.tmp", MyScript ) JobModify( NewJobNumber, "script", MyScript ) Please note that the file is opened in the LineMode and because of that it doesn't require manually adding "new-line" symbols after each line. These symbols are added automatically by FileWrite. BTW: Why do you want to create such big script job dynamically. Why not to create a ScriptLibrary method with parameters? You then can call this method with different parameter values and it is also easier to script and debug. : I am trying to dynamically create a job that contains a large JAL script : using another job with JAL scripting. I am using the JobModify statement : but have not been able to get the entire script into the dynamically : created job. Here is a sample of the code I am using. Is there any way to : do this using JAL? This example only creates a portion of the JAL code in : the dynamically created job. Note that I changed the escape character to : be the ^ symbol. The dynamic JAL in this example is only a portion of what : I am trying to create. : JobCreate( NewJobNumber ) : JobModify( NewJobNumber, "name", "Built Job 2" ) : JobModify( NewJobNumber, "job_type", "s" ) : JobModify( NewJobNumber, "schedule_type", "x") : JobModify( NewJobNumber, "script_type", "JAL" ) : JobModify( NewJobNumber, "script", " & : // declare the global variables ^n & : // ***************************************** ^n & : // *** DB2 STOP Instance *** ^n & : // ***************************************** ^n & : ^n & : // declare the global variables ^n & : Dim DB2_InstanceName, string, ^"DB2^" ^n & : Dim DB2_DoNotSetInstance, boolean, False ^n & : ^n & : Dim JS_DriveLetter, string ^n & : Left( @V^"24x7_home^", 1, JS_DriveLetter ) ^n & : Dim JS_Dir, string, ^"job_scripts^" ^n & : Dim JS_ScriptFilePathNoExt, string ^n & : Dim JS_ScriptFileExtension, string, ^"cmd^" ^n & : Dim JS_LogFileExtension, string, ^"log^" ^n & : Dim JS_SQLFileExtension, string, ^"sql^" ^n & : Dim MISC_JobTimeOut, number, 30 ^n & : ^n & : Dim JS_File_Name,string, ^"db2stop^" ^n & : ConcatEx (JS_DriveLetter, ^":\\^", JS_Dir, ^"\\^", : DB2_InstanceName, ^"_^", JS_File_Name, JS_ScriptFilePathNoExt) : ^n & : ^n & : Exit " ) : Thanks, : Greg
|
|
Tue Apr 30, 2002 10:27 am |
|
 |
Greg Johnson
Joined: 20 Oct 2001 Posts: 26
|
|
Re: JobModify statement & large JAL scripts |
|
I tried the Concat solution. The JAL script in the dynamic job is still truncated. It appears as if the largest string that can be constructed in the JAL in the dynamic job is 491 characters. I don't use the ScriptLibrary because the dynamic job will be running on a remote machine. I will have many remote machines that I am using this techique on. Using the ScriptLibrary would mean that I would have to maintain the scripts across all the remote machines. Constructing the job the way I am currently doing it requires maintenance on only one machine. If you have a solution to maintaining the ScriptLibrary on many machines I would be willing to try this solution. : String constants cannot spawn multiple lines, in other words the line : continuatiion symbol "&" cannot be used withing hard-coded : strings for text continuation. : You have two options: First is to do evering in a script using Concat or : ConcatEx statements : Example: Dim( MyScript, string ) : Concat( MyScript, "// declare the global variables ^n", MyScript ) : Concat( MyScript, "Dim DB2_InstanceName, string, ^"DB2^" : ^n", MyScript ) : Concat( MyScript, "Dim DB2_DoNotSetInstance, boolean, False ^n", : MyScript ) : ... and so on : JobModify( NewJobNumber, "script", MyScript ) : Second option is to write the script line by line to a temp file then read it : back using FileReadAll : Example: Dim( FileNo, number ) : FileOpen( "temp.tmp", "LineMode", "Write", : False, FileNo ) : FileWrite( FileNo, "// declare the global variables" ) : FileWrite( FileNo, "Dim DB2_InstanceName, string, : ^"DB2^"" ) : FileWrite( FileNo, "Dim DB2_DoNotSetInstance, boolean, False " ) : ... and so on : FileReadAll( "temp.tmp", MyScript ) : JobModify( NewJobNumber, "script", MyScript ) : Please note that the file is opened in the LineMode and because of that it : doesn't require manually adding "new-line" symbols after each : line. These symbols are added automatically by FileWrite. : BTW: Why do you want to create such big script job dynamically. Why not to : create a ScriptLibrary method with parameters? You then can call this : method with different parameter values and it is also easier to script and : debug.
|
|
Tue Apr 30, 2002 12:00 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
Re: JobModify statement & large JAL scripts |
|
There is not such limit. The virtual limit is 2 Gig. This must be something else. When you run your script in the Debugger step-by-step do you see where the text gets truncated? As for the ScriptLibrary, take a look at RemoteCopySettings. May be it can help you. : I tried the Concat solution. The JAL script in the dynamic job is still : truncated. It appears as if the largest string that can be constructed in : the JAL in the dynamic job is 491 characters. : I don't use the ScriptLibrary because the dynamic job will be running on a : remote machine. I will have many remote machines that I am using this : techique on. Using the ScriptLibrary would mean that I would have to : maintain the scripts across all the remote machines. Constructing the job : the way I am currently doing it requires maintenance on only one machine. : If you have a solution to maintaining the ScriptLibrary on many machines I : would be willing to try this solution.
|
|
Tue Apr 30, 2002 12:11 pm |
|
 |
Greg Johnson
Joined: 20 Oct 2001 Posts: 26
|
|
Re: JobModify statement & large JAL scripts |
|
In the Debugger all of the text makes it to the string variable. When the JobModify statement gets issued the only thing that makes it to the new job's JAL is the first 491 characters of the string variable. I am running version 3.1.3. : There is not such limit. The virtual limit is 2 Gig. This must be something : else. When you run your script in the Debugger step-by-step do you see : where the text gets truncated? : As for the ScriptLibrary, take a look at RemoteCopySettings. May be it can : help you.
|
|
Tue Apr 30, 2002 12:55 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
Re: JobModify statement & large JAL scripts |
|
Please upgrade to the most recent version 3.2 (it is a free upgrade) I believe the version you are running internally uses DDE for some interprocess communications. You hit the Windows DDE limit on the DDE data transfer. The recent version uses different interprocess communication methods and it should not have this limit. : In the Debugger all of the text makes it to the string variable. When the : JobModify statement gets issued the only thing that makes it to the new : job's JAL is the first 491 characters of the string variable. I am running : version 3.1.3.
|
|
Tue Apr 30, 2002 1:01 pm |
|
 |
Greg Johnson
Joined: 20 Oct 2001 Posts: 26
|
|
Re: JobModify statement & large JAL scripts |
|
OK... I upgraded to version 3.2.4. I am still getting the truncation to 491 characters in the new dynamic job for the JAL script. : Please upgrade to the most recent version 3.2 (it is a free upgrade) : I believe the version you are running internally uses DDE for some : interprocess communications. You hit the Windows DDE limit on the DDE data : transfer. : The recent version uses different interprocess communication methods and it : should not have this limit.
|
|
Tue Apr 30, 2002 1:29 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
Re: JobModify statement & large JAL scripts |
|
I was able to reproduce your problem but I cannot yet figure out where it hit the 491 charcaters limit. But I found a workaround: Do not write your script to the "script" job property, write it to a file with .JAL extension (for instance name it myscript.jal) and then for the new job script specify "@SCRIPT:myscript.jal" : OK... I upgraded to version 3.2.4. I am still getting the truncation to 491 : characters in the new dynamic job for the JAL script.
|
|
Tue Apr 30, 2002 7:08 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|