Routine Code

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It might be interesting to compare how many machine operations each requires.

Code: Select all

0001:       FUNCTION TEST(COUNTRY_CD)
0002:
0003: * Conditional statement
0004:       If COUNTRY_CD = 'c'
0005:       Then
0006:          Ans = 2
0007:       End
0008:       Else
0009:          Ans = 0
0010:       End
0011:
0012: * Conditional expression
0013:       Ans = If COUNTRY_CD = 'c' Then 2 Else 0
0014:
0015:       RETURN(Ans)
0016:    END
Here's the result of VLIST which shows that they generate identical opcodes (eq, testfw, move, jump, move).

Code: Select all

Subroutine "BP.O/TEST"
Compiler Version: 7.0.1.1
Object Level    : 5
Machine Type    : 0
Local Variables : 1
Subroutine args : 2
Unnamed Common  : 0
Named Common Seg: 0
Object Size     : 86
Source lines    : 16

00001:       FUNCTION TEST(COUNTRY_CD)

00002:

00003: * Conditional statement

00004:       If COUNTRY_CD = 'c'
00004 00000 : 06E eq             COUNTRY_CD "c"  => $R0
00004 00008 : 2DE testfw         $R0 0001C:

00005:       Then

00006:          Ans = 2
00006 00010 : 0F8 move           2  => Ans
00006 00016 : 0C2 jump           00022:

00007:       End

00008:       Else

00009:          Ans = 0
00009 0001C : 0F8 move           0  => Ans

00010:       End

00011:

00012: * Conditional expression

00013:       Ans = If COUNTRY_CD = 'c' Then 2 Else 0
00013 00022 : 06E eq             COUNTRY_CD "c"  => $R0
00013 0002A : 2DE testfw         $R0 00040:
00013 00034 : 0F8 move           2  => Ans
00013 0003A : 0C2 jump           00046:
00013 00040 : 0F8 move           0  => Ans

00014:

00015:       RETURN(Ans)
00015 00046 : 0F8 move           Ans  => _T0000
00015 0004C : 15C return

00016:    END
00016 0004E : 0F8 move           ""  => _T0000
00017 00054 : 15C return
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

Thanks ray.wurlod and chalasaniamith....appreciate all your suggestions and responses. This indeed is a great site.

DS_MJ
Baldmartyr
Participant
Posts: 108
Joined: Mon Oct 21, 2002 8:30 am

Post by Baldmartyr »

DS_MJ wrote:This indeed is a great site.

DS_MJ
Glad you think so. Feel free to add to our Testimonials forum.
David Baldwin
Former DSXchange Webmaster
Post Reply