-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSTUDMOD.SQLRPGLE
99 lines (76 loc) · 1.98 KB
/
STUDMOD.SQLRPGLE
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
**FREE
Ctl-Opt NOMAIN;
/copy qrpgleref,siscpybk
Dcl-PROC newStud export;
Dcl-Pi newStud zoned(3);
hname char(10);
END-PI;
//varibles
Dcl-S returnCode zoned(3);
Dcl-S detID zoned(5);
//clearing for call
cancel = *off;
exit = *off;
Husername = hname;
clear *all(newstudctl);
clear nwstudopt;
clear courmsg;
clear courmsg1;
Exec Sql SET OPTION COMMIT = *NONE;
//populating the subrecord
subclear2 = *off;
Write NewStudCtl;
RRN = 0;
subclear2 = *on;
SetLL *start corMaster;
Read corMaster;
DoU (%EOF(corMaster));
RRN += 1;
Write NewStudSFL;
Read corMaster;
ENDDO;
DoW (Exit = *Off AND Cancel = *Off);
write header;
write footerCour;
ExFmt NewStudCtl;
ReadC newStudSFL;
clear courmsg;
clear courmsg1;
//Saving a New Student
SetGT *hival StuMaster;
ReadP(N) StuMaster;
If (NewStudInp <> *BLANK AND AddrInp <> *BLANK AND NwStudOpt = '1' AND save = *on);
StuID += 10; //auto generate stuID to 10 past the last one
detID = StuID;
SemID = 1; // auto generate Semester ID to one making all new studs freshman
StuName = %TRIM(newStudInp);
StudAddr = %TRIM(AddrInp);
StuCourID = courseID;
write(E) stumasfmt;
Read StuDetails;
StuId = detID; //auto enroll new student in College 101, subid 10
SubjectID = 10;
Marks = 0;
write(E) StuDetFmt;
clear *all(newstudctl);
clear nwstudopt;
update(E) newstudsfl;
courmsg1 = ('Success New StuID: ' + %CHAR(stuID));
//throw error for blank
Else;
courMsg = 'Blanks not valid';
ENDIF; // saving
//Indicators
If (exit = *on);
ReturnCode = 222;
ElseIf (cancel = *on);
ReturnCode = 999;
ElseIf (refresh = *on);
clear *all(newstudctl);
clear nwstudopt;
clear courmsg;
clear courmsg1;
ENDIF;
ENDDO;
return returnCode;
END-PROC;