![]() |
Collapse All | Expand All | Show Default |
| KgdRemoveDir
DataStage Routine Report Generated 2004-07-11 09:47:08pm |
|  - Routine Information   |
| Property | Value |
| SubType | Transform Function  |
| Category | KimD  |
| Author | Kim Duke  |
| Arg Count | 1  |
| Version | 2.0.0  |
| Routine Type | 0  |
| Short Description | Remove a directory KimD/routines would mkdir KimD then mkdir KimD/routines  |
| Long Description | Routine: KgdRemoveDir ================================================================= Description: Remove a directory KimD/routines would mkdir KimD then mkdir KimD/routines. ================================================================= Arguments: 1. DirName ================================================================= Modification History ================================================================= Developer Date Modification description ======== ========= ============================================== kduke 2004-05-28 created ======== ========= ==============================================   |
|  - Arguments   |
| Argument | Description |
| DirName |   |
|  - Source Code   |
| LineNo | Source Code |
| 1 |        FUNCTION KgdRemoveDir(DirName) |
| 2 | * ------------------------------------------------------------ |
| 3 | * KgdRemoveDir(DirName) |
| 4 | * Decription: This routine will remove DirName |
| 5 | * Written by: Kim Duke |
| 6 | * Notes: |
| 7 | * ------------------------------------------------------------ |
| 8 | * $INCLUDE DSINCLUDE JOBCONTROL.H |
| 9 |        Ans = @FALSE |
| 10 |        If System(91) = 0 Then |
| 11 |           Shell = "UNIX" |
| 12 |           Sep = '/' |
| 13 |           OtherSep = '\' |
| 14 |           RmCmd = 'rm -rf ' |
| 15 |        End Else |
| 16 |           Shell = "DOS" |
| 17 |           Sep = '\' |
| 18 |           OtherSep = '/' |
| 19 |           RmCmd = 'DEL /S ' |
| 20 |        End |
| 21 |        convert OtherSep to Sep in DirName |
| 22 |        print "Shell = ":Shell |
| 23 |        print "Sep = ":Sep |
| 24 | * ------------------------------------------------------------ |
| 25 |        OpenPath DirName To FileVariable Then |
| 26 |           Close FileVariable |
| 27 |           Command = RmCmd:DirName |
| 28 |           print Command |
| 29 | * ------------------------------------------------------------ |
| 30 |           Call DSExecute(Shell, Command, Output, ErrorCode) |
| 31 |           If ErrorCode > 0 Then |
| 32 |              Ans = @FALSE |
| 33 |              print "ErrorCode = ":ErrorCode |
| 34 |              goto TheEnd |
| 35 |           End Else |
| 36 |              Ans = @TRUE |
| 37 |           End |
| 38 |        End |
| 39 | * ------------------------------------------------------------ |
| 40 | TheEnd: |
| 41 |        print "Ans = ":Ans |
| 42 |   |
| 43 |   |
| 44 |        RETURN(Ans) |