Procedures / functions to perform Subject Cancellations i3bpkg.sql


Procedures and functions that is used in {SREGC-4} and {SREGC-8} - package name i3bpkg.sql.



Function/Procedure Name Function Description Comments
cancel_subject_main To cancel or uncancel a main subject AND all its modules. This function calls either cancel_subject.i3bpkg.sql or uncancel_subject.i3bpkg.sql that will perform all cancellation or uncancel validations and updating.
INPUTS
  • x_stno            student number
  • x_cyr              academic year
  • x_subj             subject code
  • x_subjno          subject number
  • x_cancind        'C' for cancel, 'U' for uncancel, 'R' for cancellation reason change
  • x_cancdate      Cancellation date: must fall between start and end reg dates
  • x_cancreason   cancellation reason code - must be a valid reason code for cancellation reason changes this must be the new reason code
  • x_cancform       cancellation form number - optional
  • x_remark          remark - optional
  • x_user              user code
  • x_coop              Y if inservice/exper subject; else N: default N
  • x_canc_sguide   must study guide requests be cancelled / generated
  • x_canc_access  must access control be cancelled / opened if last / first subject
  • x_batch             indicator must be Y if called from a batch report - if this flag is

OUTPUTS
  • i31pkg.i31validation:
  • i31Validation IS RECORD (status  VARCHAR2(200)  default '', message VARCHAR2(2000) default '');
Processing Rules:
VALIDATIONS (applicable to main and module subjects)
  • Student number validations
  • Subject record must exist (IAHSUB) for main subject
  • User restrictions (validations RV and RM on {SMNT-5} )
CANCEL
  • Cancel main subject first
  • If subject has modules linked to the same block as the main,(stud.i22pkg.CalcNumofModules)
  • Read all modules and cancel each of them
UNCANCEL
  • Uncancel main subject first
  • If subject has modules,(stud.i22pkg.CalcNumofModules)
  • Read all modules and uncancel each of them

CANCELLATION REASON CHANGE
  • Do cancellation reason change first for main and then for each module, if the module has the same original cancel reason as the mother. If the module was cancelled on its own with a different reason, the reason of this module will not be changed.
cancel_subject_main_sregc4 To cancel or uncancel a main subject AND all its modules. This function calls either cancel_subject.i3bpkg.sql or uncancel_subject.i3bpkg.sql that will perform all cancellation or uncancel validations and updating.
INPUTS
  • x_stno            student number
  • x_cyr              academic year
  • x_subj             subject code
  • x_subjno          subject number
  • x_cancind        'C' for cancel, 'U' for uncancel, 'R' for cancellation reason change
  • x_cancdate      Cancellation date: must fall between start and end reg dates
  • x_cancreason   cancellation reason code - must be a valid reason code for cancellation reason changes this must be the new reason code
  • x_cancform       cancellation form number - optional
  • x_remark          remark - optional
  • x_user              user code
  • x_coop              Y if inservice/exper subject; else N: default N
  • x_canc_sguide   must study guide requests be cancelled / generated
  • x_canc_access  must access control be cancelled / opened if last / first subject
  • x_batch             indicator must be Y if called from a batch report - if this flag is

OUTPUTS
  • i31pkg.i31validation:
  • i31Validation IS RECORD (status  VARCHAR2(200)  default '', message VARCHAR2(2000) default '');
Processing Rules:
VALIDATIONS (applicable to main and module subjects)
  • Student number validations
  • Subject record must exist (IAHSUB) for main subject
  • User restrictions (validations RV and RM on {SMNT-5} )
  • may not have a result code (if the SOD (MC,SR) is Y, the subject may be cancelled with a result, if N, the subject may not be cancelled if a result exist.)
CANCEL
  • Cancel main subject first
  • If subject has modules linked to the same block as the main,(stud.i22pkg.CalcNumofModules)
  • Read all modules and cancel each of them
  • may not have a result code (if the SOD (MC,SR) is Y, the subject may be cancelled with a result, if N, the subject may not be cancelled if a result exist.)
UNCANCEL
  • Uncancel main subject first
  • If subject has modules,(stud.i22pkg.CalcNumofModules)
  • Read all modules and uncancel each of them

CANCELLATION REASON CHANGE
  • Do cancellation reason change first for main and then for each module, if the module has the same original cancel reason as the mother. If the module was cancelled on its own with a different reason, the reason of this module will not be changed.
cancel_subject To cancel a single subject. Is called by cancel_subject_main, for the main subject and each of its modules It performs all validations involved with a subject cancellation, It performs all actions involved with a subject cancellation, such as the generation of fees, cancellation of study guides, insert of before and after images into the log file, if this is the last subject to be cancelled, the access control will also be closed.
INPUTS
  • x_stno        student number
  • x_cyr         academic year
  • x_subj        subject code
  • x_subjno      subject number
  • x_cancdate    Cancellation date: must fall between start and end reg dates
  • x_cancreason  cancellation reason code - must be a valid reason code
  • x_cancform    cancellation form number - optional
  • x_remark      remark - optional
  • x_user        user code (needed for study guides to create batch request must exist on gdf)
  • x_coop        'Y' if inservice/exper subject; else 'N' : default 'N'
  • x_canc_sguide must study guide outstanding requests be cancelled : default 'N',
  • x_canc_access 'Y' or 'N': must access control be cancelled if it is the last subject to be cancelled :: default 'N'
  • x_batch       indicator must be Y if called from a batch report - if this flag is Y then ICHSUB will be inserted, if N ICHSUB will not be inserted

OUTPUTS
  • i31pkg.i31validation:
  • i31Validation IS RECORD (status  VARCHAR2(200)  default '', message VARCHAR2(2000) default '');
Processing Rules:
VALIDATIONS:
  • User Restrictions (validations RV and RM {SMNT-5})
  • Qualification validations:
  • may not be completed
  • skills qual: may not be completed
  • Subject validations:
  • may not have a result code
  • may not be cancelled already
  • Cancellation date :
  • must be not-null
  • sysdate must be in system cycle N
  • may not be in future
  • May not be before registration start date
  • Canc reason validations - must be valid for cancellation
UPDATING:
  • Insert log file before image for program codes 64 and 34
  • Update iahsub: set cancel Reason, cancel Date, cancel Form and Remark
  • Cancel study guides if flag set to Y
  • Fees - do events 22 and 23 - only if not exempted
  • Insert log file after image for program codes 64 and 34
  • If last subject cancel access control if requested to do so
  • If from batch prog (eg {SREGC-8}) insert a record into ICHSUB stat = CAN
cancel_subject_sregc4 To cancel a single subject. Is called by cancel_subject_main, for the main subject and each of its modules It performs all validations involved with a subject cancellation, It performs all actions involved with a subject cancellation, such as the generation of fees, cancellation of study guides, insert of before and after images into the log file, if this is the last subject to be cancelled, the access control will also be closed.
INPUTS
  • x_stno        student number
  • x_cyr         academic year
  • x_subj        subject code
  • x_subjno      subject number
  • x_cancdate    Cancellation date: must fall between start and end reg dates
  • x_cancreason  cancellation reason code - must be a valid reason code
  • x_cancform    cancellation form number - optional
  • x_remark      remark - optional
  • x_user        user code (needed for study guides to create batch request must exist on gdf)
  • x_coop        'Y' if inservice/exper subject; else 'N' : default 'N'
  • x_canc_sguide must study guide outstanding requests be cancelled : default 'N',
  • x_canc_access 'Y' or 'N': must access control be cancelled if it is the last subject to be cancelled :: default 'N'
  • x_batch       indicator must be Y if called from a batch report - if this flag is Y then ICHSUB will be inserted, if N ICHSUB will not be inserted

OUTPUTS
  • i31pkg.i31validation:
  • i31Validation IS RECORD (status  VARCHAR2(200)  default '', message VARCHAR2(2000) default '');
Processing Rules:
VALIDATIONS:
  • User Restrictions (validations RV and RM {SMNT-5})
  • Qualification validations:
  • may not be completed
  • skills qual: may not be completed
  • Subject validations:
  • may not have a result code (if the SOD (MC,SR) is Y, the subject may be cancelled with a result, if N, the subject may not be cancelled if a result exist.)
  • may not be cancelled already
  • Cancellation date :
  • must be not-null
  • sysdate must be in system cycle N
  • may not be in future
  • May not be before registration start date
  • Canc reason validations - must be valid for cancellation
UPDATING:
  • Insert log file before image for program codes 64 and 34
  • Update iahsub: set cancel Reason, cancel Date, cancel Form and Remark
  • Cancel study guides if flag set to Y
  • Fees - do events 22 and 23 - only if not exempted
  • Insert log file after image for program codes 64 and 34
  • If last subject cancel access control if requested to do so
  • If from batch prog (eg {SREGC-8}) insert a record into ICHSUB stat = CAN
uncancel_subject To uncancel a subject
INPUTS
  • x_stno        student number
  • x_cyr         academic year
  • x_subj        subject code
  • x_subjno      subject number
  • x_user        user code
  • x_coop        'Y' if inservice/exper subject; else 'N' :: default 'N'
  • x_canc_sguide should study guides request be generated - Y/N
  • x_canc_access should access control be reinstated if last subject now uncancelled - Y/N
  • x_batch       indicator must be Y if called from a batch report - if this flag is Y then ICHSUB will be inserted, if N ICHSUB will not be inserted
OUTPUTS
  • i31pkg.i31validation:
  • i31Validation IS RECORD (status  VARCHAR2(200)  default '', message VARCHAR2(2000) default '');
Processing Rules:
VALIDATIONS:
  • User Restrictions (validations RV and RM {SMNT-5})
  • Qualification validations:
    • may not be cancelled
  • Subject validations:
  • must be active on curriculum
  • previously enrolled
  • another subject already exists
  • subject must be cancelled
  • Cancellation date :
    • System Date must be in cycle N
UPDATING:
  • Insert log file before image for program codes 63 and 18
  • Update iahsub: set cancel Reason, cancel Date, cancel Form and Remark to NULL
  • Study guides - generate request - if flag is Y
  • Fees - contra iamlog transaction
  • Insert log file after image for program codes 63 and 18
  • If last subject activate access control if requested to do so
  • If form batch program (at this stange there is no batch uncancel) insert a record into ICHSUB stat = UNC
getSubjReg To fetch all subject registration related field values into a RECORD
 INPUTS
  •  x_stno        student number
  •  x_cyr         academic year
  •  x_subj        subject code
  •  x_subjno      subject number
  •  x_subjRegType OUT t_subjReg,i3bpkg.sql: record returned
  •  x_return      OUT i31pkg.i31Validation
OUTPUTS
  • Record with subject registration details
  • i31pkg.i31validation:
  • i31Validation IS RECORD status  : 'OK', 'ERROR', 'SQLERROR', message : error message or NULL
t_subjReg All subject registration detail fields
OUTPUTS
  • cyr            academic year,
  • stno          student number
  • qualNo      subject qual number
  • ot              subject offering type
  • bc             subject block code
  • sdate         subject start date
  • edate         subject end date
  • regDate      subject registration date
  • cancelDate  subject cancel date
  • cancReason  subject cancel reason
  • eres           subject result
  • exempt      subject exempt indicator
  • exmcyr      subject exam year
  • qual           subject qualification
  • origseq      subject original sequence
  • IAHrowid    subject row-id
getQualReg To fetch all qualification registration related field values into a RECORD
INPUTS
  • x_stno              student number
  • x_cyr                academic year
  • x_qualno           qualification number
  • x_qualRegType  OUT t_qualReg,i3bpkg.sql: record returned
  • x_return             OUT i31pkg.i31Validation
OUTPUTS
  • Record with qualification registration details
  • i31pkg.i31validation:
  • i31Validation IS RECORD status  : 'OK', 'ERROR', 'SQLERROR' message : error message or NULL
t_qualReg All qualification registration detail fields
OUTPUTS
  • cyr           academic year
  • stno          student number
  • qualNo      qualification number
  • qual          qualification code
  • complete   qualification complete indicator
  • cancdate   qualification cancellation date
chkValidCancReason Check if cancellation reason is valid. Returns admin indicator.
INPUTS
  • x_cancreason   cancellation reason code
  • x_ibrind            cancellation reasons admin error indicator - Y or N
OUTPUTS
  • Y if reason code OK, else a N
Canc_Guides To cancel outstanding requests issued for a subject. It creates a batch request to execute ie4ccc.pc.
INPUTS
  • x_stno          student number
  • x_subj          subject code
  • x_cyr            academic year
  • x_exmcyr      end academic year
  • x_bc             block code
OUTPUTS
  • i31pkg.i31validation:
  • i31Validation IS RECORD (status  VARCHAR2(200)  default '', message VARCHAR2(2000) default '');

Create batch request for ie4ccc.pc in queue - using SOD PH from {GCS2-11} to get the path
checkLastSubj Checks if this is the last subject (being cancelled or uncancelled), ie that there is no other subject registration for the student that is not cancelled, with no result or with a 'passed' result, when the block period is not over
INPUTS
  • x_stno        student number
  • x_cyr         academic year
  • x_subj        subject code
  • x_bc          block code
OUTPUTS
  • 'OK'                 there is NO other active subject left for the student
  • 'NOTOK'          there IS another active subject left for the student
  • 'SQLERROR'    sqlerror encountered
Ins_Caqlog Inserts log file record in caqlog for a subject registration record
INPUTS
  • x_stat    status of logfile entry - 'OLD' or 'NEW'
  • x_prog    program number for logfile entry
  • x_user    user code
  • x_rowid   rowid of IAHSUB record
OUTPUTS
  • i31pkg.i31validation:
  • i31Validation IS RECORD (status  VARCHAR2(200)  default '', message VARCHAR2(2000) default '');
  • Possible values of status returned:
    • 'OK'                 logfile entry was successfully created
    • 'ERROR'          IAHSUB record not found
    • 'SQLERROR'    sqlerror encountered
updateAccessControl If there are no active subjects left, close the access control if the last subject is cancelled. If a subject is uncancelled, and if there are no other active subjects, open the access control.
INPUTS
  • x_stno       student number
  • x_cyr         academic year
  • x_subj       subject code
  • x_bc          block code
  • x_user       user
  • x_iahrowid  rowid of IAH record
  • x_ind         C - cancel / U - uncancel
OUTPUTS
  • i31pkg.i31validation:
  • i31Validation IS RECORD (status  VARCHAR2(200)  default '', message VARCHAR2(2000) default '');
  • Possible values of status returned:
    • 'OK'                 logfile entry was successfully created
    • 'SQLERROR'    sqlerror encountered
checkSameSubj Tests if there is another subject registration record, for the student, year and block, and the same subject code, that is not cancelled. Then the subject may not be uncancelled, as there will then be duplicate subject registration records
INPUTS
  • x_stno       student number
  • x_cyr         academic year
  • x_subj        subject code
  • x_bc           block code
  • x_subjno     subject number
  • x_iahrowid   rowid of IAH record
OUTPUTS
  • 'OK'                 no other 'same' subject found
  • 'SQLERROR'    sqlerror encountered
  • error message 'same' subject found
checkSODCD Finds SOD CD subsystem RE. Calculates number of days between cancellation date and sysdate. If the SOD is not 0, and the number of days is more than the number of days indicated on the SOD, uncancel is not allowed
INPUTS
  • x_cancdate  cancellation date
OUTPUTS
  • 'OK'          number of days correct
  • error message error message or SQL error message
Contra_Event_Trans Contra the fee transactions on IAMLOG for a subject, qualification, or hostel registration or cancellation. The related VAT transaction will also be 'contra'ed'.

For use by all 'uncancel' functions. This replaces the library ITS_STUD_APP.PLL program units CANC_TRANS and INS_TRANS, that are  currently used by many options on the SREGC menu.
Use of this function will be phased in.

The correct IAMLOG transaction(s) are selected, as follows:
  • for the student and origseq of the registration
  • iamudate must be NULL ie the transaction may not already form part of a contra transaction.
  • if it is a cancellation transaction to be contra'ed, the field iamidte must be equal to the current cancellation date
  • according to the x_type indicator (type of registration):
    • (S)ubject registration: selects event 07 and 17 transactions if the cancellation flag is N, else event 22 and 23 transactions for cancellations
    • (E)xemption: event 18
    • (Q)ualification registration: event 05 if cancel flag N, else event 20
    • (R)egistration event (qualification registration): event 03 if cancel flag N else event 20
    • (H)ostel registration: event 32 if cancel is N else event 54
 If a cancellation transaction is contra'ed, the current auto-no-shows (if any) for the registration (all records for the student and origseq) will be lifted from all records that have iamudate null (all records that is not contra transactions ie all "current" transactions), as the auto no-show will no longer be applicable (auto no-show only apply between transaction and its cancellation)
The function contra_IAM.i06pkg.sql is used to write a contra for the transaction(s) on iamlog.
INPUTS
  • x_stno     student number
  • x_origseq  origseq
  • x_ind      see above: S/E/Q/R/H
  • x_user     user
  • x_canc     if trans is a cancellation trans: Y/N
  • x_cancdate Cancellation date if x_canc = Y
OUTPUTS
  • OK           no problem
  • error message SQL error message
cancreason_change If a cancellation reason is changed on a subject registration, and the admin indicator differ between the old and new cancellation reasons, the cancellation transactions generated will be contra'ed and new cancellation transactions will be generated according to the admin indicator of the new cancellation reason
INPUTS
  • x_stno      student number
  • x_cyr       academic year
  • x_subj      subject
  • x_subjno    subject number
  • x_newreas   new cancellationr reason
  • x_user      usercode
  • x_coop      'Y' if inservice/exper subject; else 'N', default 'N'
OUTPUTS
  • i31pkg.i31validation:
  • i31Validation IS RECORD (status  VARCHAR2(200)  default '', message VARCHAR2(2000) default '');
  • Possible values of status returned:
    • 'OK'          logfile entry was successfully created
    • 'SQLERROR'    sqlerror encountered

Processing Rules:
  • User Restrictions  (validations RV and RM)
  • Validate old reason and get indicator
  • Validate new reason and get indicator
  • Only if cancel reasons admin indicator has changed, do:
    • Do log file before image for program codes 64 and 34
    • Update Subject Record
    • Canc transactions
    • Do event 22 and 23
    • Do Log file after image for program codes 64 and 34


See Also:



History of Changes

Date System Version By Whom Job Description
23-Feb-2010 v02.0.0.0 Bea Swart t169043 New manual.
11-Jul-2013 v02.0.0.1 Bea Swart t186086 Add SOD (MC,SR)
22-Nov-2013 v02.0.0.2 Melanie Zeelie t192763 Add info on cancellation , module block to be equal to main block
08-Feb-2022 v04.1.0.0 Goodman Kabini F253560 Copy the manual from Int2 to Int4.1 and remove the Image for USERS-1