Skip to content

Instantly share code, notes, and snippets.

@prb112
Created April 14, 2016 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prb112/279ba1b5091d4ac990e30eda2e890082 to your computer and use it in GitHub Desktop.
Save prb112/279ba1b5091d4ac990e30eda2e890082 to your computer and use it in GitHub Desktop.
CREATE COMPUTE MODULE CreateData_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE Source CHARACTER 'Production' ;
DECLARE DBSchema CHARACTER 'DB2ADMIN';
DECLARE Table CHARACTER 'EMPLOYEE';
SET OutputRoot = InputRoot;
DECLARE EMPNO1 REFERENCE TO InputRoot.JSON.Data.EMPNO;
DECLARE FIRSTNME1 REFERENCE TO InputRoot.JSON.Data.FIRSTNME;
DECLARE LASTNAME1 REFERENCE TO InputRoot.JSON.Data.LASTNAME;
DECLARE JOB1 REFERENCE TO InputRoot.JSON.Data.JOB;
DECLARE EDLEVEL1 REFERENCE TO InputRoot.JSON.Data.EDLEVEL;
INSERT INTO Database.EMPLOYEE (EMPNO, FIRSTNME, LASTNAME, JOB, EDLEVEL)
VALUES (EMPNO1, FIRSTNME1, LASTNAME1, JOB1, EDLEVEL1);
-- Set the Repsonse Here
-- you can modify the initial message, or create a new object
CREATE FIELD OutputRoot.JSON.Data.SUCCESS TYPE NameValue Value '';
SET OutputRoot.JSON.Data.SUCCESS = 'Details of Success Are Here';
PROPAGATE;
RETURN TRUE;
END;
END MODULE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment