-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathhello_asm.groovy
49 lines (38 loc) · 1.91 KB
/
hello_asm.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import com.ibm.dbb.build.*
// Change the following variables to match your system
hlq = "USER"
sourceDir = "/u/user/build"
macLib = "SYS1.MACLIB"
//userMacLib = "USER.MACLIB" //Uncomment if needed
println("Creating ${hlq}.HASRC. . .")
CreatePDS createPDSCmd = new CreatePDS();
createPDSCmd.setDataset("${hlq}.HASRC");
createPDSCmd.setOptions("tracks space(1,1) lrecl(80) dsorg(PO) recfm(F,B) dsntype(library)");
createPDSCmd.create();
println("Creating ${hlq}.HAMOD. . .")
createPDSCmd.setDataset("${hlq}.HAMOD");
createPDSCmd.setOptions("tracks space(1,1) lrecl(80) dsorg(PO) recfm(F,B) dsntype(library)");
createPDSCmd.create();
// copy program to PDS
println("Copying hello.asm to ${hlq}.HASRC")
new CopyToPDS().file(new File("${sourceDir}/hello.asm")).dataset("${hlq}.HASRC").member("HELLO").execute()
// assemble the build file
println("Assembling hello.asm")
// define the MVSExec command to compile the file
def compile = new MVSExec().file("${sourceDir}/hello.asm").pgm("ASMA90").parm("")
// add DD statements to the MVSExec command
compile.dd(new DDStatement().name("SYSIN").dsn("${hlq}.HASRC(HELLO)").options("shr").report(true))
compile.dd(new DDStatement().name("SYSLIN").dsn("${hlq}.HAMOD(HELLO)").options("shr").output(true))
compile.dd(new DDStatement().name("SYSPRINT").options("cyl space(5,5) unit(vio) new"))
compile.dd(new DDStatement().name("SYSUT1").options("cyl space(5,5) unit(vio) new"))
// add a syslib to the compile command with optional CICS concatenation
compile.dd(new DDStatement().name("SYSLIB").dsn("${macLib}").options("shr"))
//compile.dd(new DDStatement().dsn("${userMacLib}").options("shr")) //Uncomment if user maclib needed
// log
compile.copy(new CopyToHFS().ddName("SYSPRINT").file(new File("${sourceDir}/hello_asm.log")))
// execute the MVSExec compile command
def rc = compile.execute()
if (rc > 4)
println("Assembly failed! RC=$rc")
else
println("Assembly successful! RC=$rc")