I have added a small loop to add TRANSFORMATION target table column name. Source table column name not included yet as it will make the output dataset more bulky. col_cnt=0; do while(col_cnt <rc_cols); col_cnt=col_cnt+1; tgt_col_uri=""; tgt_col_nm=""; rc = metadata_getnasn(tgt_uri, 'Columns',col_cnt, tgt_col_uri); rc = metadata_getattr(tgt_col_uri, 'Name',tgt_col_nm); output; end; ********************************************************** options metaserver="<server>" metaport=8561 metaprotocol=bridge metarepository="Foundation" metauser=<user name> metapass=<password>; data Job_input_output; length job_name job_uri ctrl_order_uri step_uri step_name src_uri src_lib_uri tgt_lib_uri tree_uri jf_uri job_name src_name src_lib_nm tgt_uri tgt_name tgt_lib_nm tgt_col_uri tgt_col_nm $256 ; /* To initialize variables */ nobj = 1; n = 0; keep job_name step_name src_name src_lib_nm tgt_name tgt_lib_nm lib_uri tgt_col_nm ; do while(nobj >= 0 ); /* Loop start- Determine how many jobs are on this repository and identify inputs & outputs. */ n = n+1; /* To get the number of jobs */ nobj = metadata_getnobj("omsobj:Job?@Name contains ''", n, job_uri); put "nobj =" nobj "n = " n; if n = 1 then do; call symput('nobj', trim(left(nobj))); /* Number of Job objects found. */ if nobj lt 1 then do; put 'Note: No Job objects found in this repository.'; stop; end; end; /* To get job name */ rc= metadata_getattr(job_uri,'Name',job_name); rc= metadata_getattr(job_uri,'Name',job_name); rc_jf = metadata_getnasn(job_uri, 'JFJobs', 1, jf_uri); /* get the Custom association - control order */ rc = metadata_getnasn(job_uri, 'CustomAssociations', 1, ctrl_order_uri); /*find out how many steps are associated */ n_steps = metadata_getnasn(ctrl_order_uri, 'AssociatedObjects', 1, step_uri); do s = 1 to n_steps; /*Loop start - to obtain all transfromation in a job */ /* get details of each step*/ Transformation_step=s; rc = metadata_getnasn(ctrl_order_uri, 'AssociatedObjects', s, step_uri); rc = metadata_getattr(step_uri, 'Name', step_name); /* for each Step, get the Transformations assoc. */ uri = step_uri; rc = metadata_getnasn(uri, 'Transformations', 1, step_uri); rc_s = metadata_getnasn(step_uri, 'ClassifierSources', 1, src_uri); c=0; do while(c <rc_s); /* Loop start- to obtain source table and its library name */ /* to reset all table name and their uri*/ src_lib_uri=""; src_lib_nm=""; src_uri=""; src_name=""; c=c+1; rc = metadata_getnasn(step_uri, 'ClassifierSources', c, src_uri); rc = metadata_getattr(src_uri, 'TableName', src_name); if lengthn(src_name) =0 then rc = metadata_getattr(src_uri, 'SASTableName', src_name); if lengthn(src_name) =0 then rc = metadata_getattr(src_uri, 'Name', src_name); rc = metadata_getnasn(src_uri, 'TablePackage',1, src_lib_uri); rc = metadata_getattr(src_lib_uri, 'Name',src_lib_nm); /*if src_lib_nm ne '' then*/ output; end; /* Loop end- to obtain source table and its library name */ /* to reset all table name and their uri*/ src_lib_uri=""; src_lib_nm=""; src_uri=""; src_name=""; rc_t = metadata_getnasn(step_uri, 'ClassifierTargets', 1, tgt_uri); c=0; do while(c <rc_t); /* Loop start- to obtain target table and its library name */ /* to reset all table name and their uri*/ tgt_lib_uri=""; tgt_lib_nm=""; tgt_uri=""; tgt_name=""; c=c+1; rc = metadata_getnasn(step_uri, 'ClassifierTargets', c, tgt_uri); rc = metadata_getattr(tgt_uri, 'TableName', tgt_name); if lengthn(tgt_name) =0 then rc = metadata_getattr(tgt_uri, 'SASTableName', tgt_name); if lengthn(tgt_name) =0 then rc = metadata_getattr(tgt_uri, 'Name', tgt_name); rc = metadata_getnasn(tgt_uri, 'TablePackage',1, tgt_lib_uri); rc = metadata_getattr(tgt_lib_uri, 'Name',tgt_lib_nm); rc_cols = metadata_getnasn(tgt_uri, 'Columns',1, tgt_col_uri); col_cnt=0; do while(col_cnt <rc_cols); col_cnt=col_cnt+1; tgt_col_uri=""; tgt_col_nm=""; rc = metadata_getnasn(tgt_uri, 'Columns',col_cnt, tgt_col_uri); rc = metadata_getattr(tgt_col_uri, 'Name',tgt_col_nm); output; end; if rc_cols<=0 then output; end; /* Loop end- to obtain target table and its library name */ /* to reset all table name and their uri*/ tgt_lib_uri=""; tgt_lib_nm=""; tgt_uri=""; tgt_name=""; end; /*Loop end - to obtain all transfromation in a job */ end;/* Loop end- Determine how many jobs are on this repository and identify inputs & outputs. */ run; If you feel it helped you then mark it as Solution or give a like.
... View more