0% found this document useful (0 votes)
34 views4 pages

Load Alternate Source Records in Different Target

The document discusses two methods for loading alternate source records into a target: 1) Using a sequence generator to generate numbers cyclically from 1 to 4, and 2) Using an IIF expression to increment a variable cyclically from 1 to 3. It also provides examples of assigning serial numbers to duplicate group values and checking for differences between two files before running a workflow.

Uploaded by

Vikas Sinha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views4 pages

Load Alternate Source Records in Different Target

The document discusses two methods for loading alternate source records into a target: 1) Using a sequence generator to generate numbers cyclically from 1 to 4, and 2) Using an IIF expression to increment a variable cyclically from 1 to 3. It also provides examples of assigning serial numbers to duplicate group values and checking for differences between two files before running a workflow.

Uploaded by

Vikas Sinha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Load alternate source records in

different target
Method1: By using sequence generator to generate start value=1 and end
value=4 in cyclic order

Method2: By using expression var=iif(var>=3,1,var+1)

Assign serial number to group value

Possible cases for duplicate value


var=iif(var>=3,1,var+1)
----------------------------------------------------------------------------------------------------------------------------------------prev=current
furrent=id
final=iif(prev=id,final+1,1)
----------------------------------------------------------------------------------------------------------------------------------------prev=current
furrent=id
iif(prev=ID,final,final+1)
----------------------------------------------------------------------------------------------------------------------------------------prev=current
furrent=id
iif(prev=ID,1,0)
Da
ta
10
1
10
1
10
1
10

cas
e1

cas
e2

cas
e3

cas
e4

case
5

101

101

202

101,101

3
1

3
1

1
2

1
0

303
405

101,101,101
101,101,101,102

case6

2
10
2
10
3
10
3
10
3

507

610

713

816

101,101,101,102,102
101,101,101,102,102,10
3
101,101,101,102,102,10
3,103
101,101,101,102,102,10
3,103,103

Session2 will run after 10 successful


runs of Session1
Workflow ----> Session1 ----> Session2
Suppose Session2 will run after 10 successful runs of Session1. What will be my
logic in this case?
Solution
Create workflow variable ,increment it by one in assignment task,
mod(variable,10)=0 is link condition

To check the file difference before


processing
Everyday before the workflow runs, check the two files file1 and file2 for
differences. If they differ, the workflow should fail and send a failure email.
Otherwise, it should continue with the rest of the workflow.
solution
#!/bin/sh
#################################################################
# Script Name : file_diff.ksh
#
# Function
: Checks for differences betweek file1 and file2 #
# Output
: returns -1 if the files differ and 0 otherwise #
#################################################################
FileDir=/home/infra/rchamarthi
LogFile=$PMWorkflowLogDir/wkf_Test.log
file1=$FileDir/file1
file2=$FileDir/file2
log(){
echo "INFO : EXTERNAL : [" `date "+%a %b %d %H:%M:%S %Y"` "]" $1 >> $LogFile
}
log "Executing script file_diff.ksh.."
log "Checking difference between $FileDir/file1 and $FileDir/file2"
if cmp -s $file1 file2; then

log "File 1 and File2 match. Exiting command task successfully."


retCode=0
else
log "file 1 and file2 are different . Diff file exists, failing command task.."
retcode=-1
fi
log "ending file diff script."
return $retCode

You might also like