TCL Statement

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

Locked
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

TCL Statement

Post by admin »

Within a datastage routine, I am trying to execute a TCL statement to copy records from one file to another.

In Universe the statement I would use is:

SELECT FILE1 with F7 # ""

COPY FROM FILE1 TO FILE2

I have tried the following in the routine and it doesnt work.

ex = SELECT FILE1 WITH F7 # ""
execute ex capturing xyz

ex = COPY FROM FILE1 to FILE2
execute ex capturing xyz

Please advise on how this is done within a datastage routine. Thx.
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

EXECUTE opens a new shell, so the Select List is lost when you return. This behaviour can be changed by using PERFORM instead of EXECUTE, or $OPTIONS EXEC.EQ.PERF which makes EXECUTE behave like PERFORM.

Also, you need to supply a "Y" to the COPY prompt that verifies that you want to copy using an active Select List. You can use a DATA statement for this.

Command = SELECT FILE1 WITH F7 # ""Command := @FM : IF @SYSTEM.RETURN.CODE > 0 THEN COPY FROM FILE1 TO FILE2 Command := @FM : DATA Y Execute Command Capturing XYZ

In DataStage we prefer to call the DSExecute subroutine to execute commands. Command = SELECT FILE1 WITH F7 # "" Command := @FM : IF @SYSTEM.RETURN.CODE > 0 THEN COPY FROM FILE1 TO FILE2 Command := @FM : DATA Y Call DSExecute("UV", Command, XYZ, ReturnCode)

> ----------
> From: Seema Ranchoddas[SMTP:seemar@netcare.co.za]
> Reply To: informix-datastage@oliver.com
> Sent: Thursday, 12 October 2000 10:11
> To: informix-datastage@oliver.com
> Subject: TCL Statement
>
> Within a datastage routine, I am trying to execute a TCL statement to
> copy records from one file to another.
>
> In Universe the statement I would use is:
>
> SELECT FILE1 with F7 # ""
>
> COPY FROM FILE1 TO FILE2
>
> I have tried the following in the routine and it doesnt work.
>
> ex = SELECT FILE1 WITH F7 # "">
> execute ex capturing xyz
>
> ex = COPY FROM FILE1 to FILE2>
> execute ex capturing xyz
>
> Please advise on how this is done within a datastage routine. Thx.
>
>
>
Locked