Image not found Collapse All | Expand All | Show Default


KgdMakeDir
DataStage Routine Report
Generated 2004-07-11 09:47:08pm


 - Routine Information  

Property Value
SubType Transform Function 
Category KimD 
Author Kim Duke 
Arg Count
Version 2.0.0 
Routine Type
Short Description make a directory KimD/routines would mkdir KimD then mkdir KimD/routines 
Long Description Routine: KgdMakeDir
=================================================================
Description:
make 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 KgdMakeDir(DirName)
2 * ------------------------------------------------------------
3 * KgdMakeDir(DirName)
4 * Decription: This routine will make all the dirs in 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        End Else
15           Shell = "DOS"
16           Sep = '\'
17           OtherSep = '/'
18        End
19        convert OtherSep to Sep in DirName
20        print "Shell = ":Shell
21        print "Sep = ":Sep
22 * ------------------------------------------------------------
23        NoOfDirs = dcount(DirName, Sep)
24        for i=1 to NoOfDirs
25           tmpDir = field(DirName, Sep, 1, i)
26           OpenPath tmpDir To FileVariable On Error
27              cmd = "mkdir ":tmpDir
28              print cmd
29 * ------------------------------------------------------------
30              Call DSExecute(Shell, cmd, 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 Then
39              Ans = @TRUE
40              Close FileVariable
41           End Else
42              cmd = "mkdir ":tmpDir
43              print cmd
44 * ------------------------------------------------------------
45              Call DSExecute(Shell, cmd, output, ErrorCode)
46              If ErrorCode > 0 Then
47                 Ans = @FALSE
48                 print "ErrorCode = ":ErrorCode
49                 goto TheEnd
50              End Else
51                 Ans = @TRUE
52              End
53           End
54        next i
55 * ------------------------------------------------------------
56 TheEnd:
57        print "Ans = ":Ans
58  
59  
60        RETURN(Ans)






Ascential and DataStage are trademarks of Ascential Software Corporation or its affiliates and may be registered in the United States or other jurisdictions.
Not for resale. For questions or comments regarding KgdGenHtml, contact kim_g_duke@hotmail.com.