1 2 Назад Вперед 15 Ответы Последний ответ: 28.01.2010 12:26, автор: Chanti

    FDM - Load two locations with same file via Batch Loader.

    702058
      Is there a way, while using the batch loader, to load two locations with the same file?

      For example:

      I have two locations, LocationA and LocationB set up in FDM where LocationA is using a different map from LocationB. I want to load the same Trial Balance file to both locations. The file is currently an automated inbound file into the OpenBatch folder with the name: 1_LocationA_WLACTUALS_Nov-2009_RR.txt. Is there any script or way of renaming that file to 1_LocationB_WLACTUALS_Nov-2009_RR.txt?

      I want to avoid having to create two inbound files since theyre the same and was wondering if theres a way via FDM to have the file go to two locations.

      Any guidance or better recommendation is greatly welcomed.

      Merry Christmas!
        • 1. Re: FDM - Load two locations with same file via Batch Loader.
          Varun Kaushal
          You can write a batch script and user windows scheduler to run that batch file before your batch loader pick the file from OpenBatch folder.
          • 2. Re: FDM - Load two locations with same file via Batch Loader.
            Chanti
            (Please excuse if there is any mistakes. this is my first post)

            If you are using the FDM's Task manager for the Batch loading, Just have a lookinto that Script whcih you have scheduled for the Batch process. you will find below row in the script.

            Set BATCHENG.PcolFiles = BATCHENG.fFileCollectionCreate(CStr(strDelimiter))
            BATCHENG.mFileCollectionProcess BATCHENG.PcolFiles, CLng(lngProcessLevel), ,CBool(blnAutoMapCorrect)

            Assume you are loading Sigle file from "OpenBatch" folderwhen ever scheduler executes the script. If so replace the above as below.

            Set BATCHENG.PcolFiles = BATCHENG.fFileCollectionCreate(CStr(strDelimiter), File1)
            BATCHENG.mFileCollectionProcess BATCHENG.PcolFiles, CLng(lngProcessLevel), ,CBool(blnAutoMapCorrect)

            Where File1 = Path for the file name to be loaded. So that file will not be moved from the "OpenBatch" folder. then you can append below VB script to the existing script to rename the file name.

            Set FSO1 = CreateObject("Scripting.FileSystemObject")
            Set File1= FSO1.GetFile("<File Path>")
            File1.move ("New path")

            Where "File Path" = FDM Directory\FDM Application\Inbox\Batches\Openbatch\1_LocationA_WLACTUALS_Nov-2009_RR.txt
            "New Path" = FDM Directory\FDM Application\Inbox\Batches\Openbatch\1_LocationB_WLACTUALS_Nov-2009_RR.txt


            and use the Batch processing script Again.

            Set BATCHENG.PcolFiles = BATCHENG.fFileCollectionCreate(CStr(strDelimiter), File2)
            BATCHENG.mFileCollectionProcess BATCHENG.PcolFiles, CLng(lngProcessLevel), ,CBool(blnAutoMapCorrect)

            Here File2 is the path for new file (LocationB.)

            So that, You can get the Single file from the Source system and you can load to two locations at a time with in the Single execution of the script. and Also make sure to write a script to copy the new file from "OpenBatch" folder to backup location like Inbox or as required as this script will not move the file from the "OpenBatch" directory. (Move script as same as mentioned above)

            Reply me if you have any doubts....
            • 3. Re: FDM - Load two locations with same file via Batch Loader.
              Varun Kaushal
              hey pragathi can u give me your gmail ID.

              Nick
              • 4. Re: FDM - Load two locations with same file via Batch Loader.
                Varun Kaushal
                Dear Pragathi

                I am not able to understand the script. Can you just wirte the script as I just want to check the execution order.

                nick
                • 5. Re: FDM - Load two locations with same file via Batch Loader.
                  629764
                  Nick - Just to keep you posted, the script pragathi suggested will work ONLY if you have two locations setup in the FDM. I hope the below example provide you more detail:

                  FDM having ONLY LocationA (w/ diff Maps) and LocationB (w/ diff Maps), no other locations.

                  'Use Parallel Processing
                  '--------------------------
                  'Declare Local Variables
                  Dim lngProcessLevel
                  Dim strDelimiter
                  Dim blnAutoMapCorrect
                  Dim lngParallelProcessCount
                  Dim strLoadBalanceServerName

                  'Initialize Variables
                  lngProcessLevel = 12 'Up-To-Check
                  strDelimiter = "@"
                  blnAutoMapCorrect = 0
                  lngParallelProcessCount = 10
                  strLoadBalanceServerName = "*SERVER NAME*"

                  Set FSO1 = CreateObject("Scripting.FileSystemObject")
                  Set X = FSO1.GetFile("D:\wldata\*App Name*\Inbox\Batches\Openbatch\G01@INDONESIA@ACTUAL@Nov-2009@RR.txt")
                  Set Y = CreateObject ("Scripting.FileSystemObject")
                  Y = X.copy("D:\wldata\*App Name*\Inbox\Batches\Openbatch\G01@CHINA@Actual@Nov-2009@RR.txt")

                  'Create the file collection
                  Set BATCHENG.PcolFiles = BATCHENG.fFileCollectionCreate(CStr(strDelimiter))',X)

                  'Execute a Standard Parallel batch
                  BATCHENG.mFileCollectionProcessParallel BATCHENG.PcolFiles, CLng(lngProcessLevel), CLng(lngParallelProcessCount), CStr(strLoadBalanceServerName), , CBool(blnAutoMapCorrect)

                  End Sub


                  Above script has been tested and worked perfectly.

                  Satya
                  • 6. Re: FDM - Load two locations with same file via Batch Loader.
                    746471
                    Thankx Satya,

                    Just thinkinig out of the box but in the file name you have fixed the month and year (Nov-2009) which would change every month so do we need to change the script every month or is there any other option.

                    Nick
                    • 7. Re: FDM - Load two locations with same file via Batch Loader.
                      629764
                      Correct!!! We need to change in the script manually, as the FDM Script does not allow us to use '?' / '*' signs. It would be ideally a better solution to setup a Batch Command using Dos to copy the file which will help to complete the process faster.

                      Satya
                      • 8. Re: FDM - Load two locations with same file via Batch Loader.
                        657263
                        Hello,

                        I wouldn't suggest using DOS.

                        I would suggest that you add more VBScripting before you execute any BatchAPI's. So that means add things to the beginning of the "generic" script to do file copy, renaming, etc. It's all standard open source VBScripting that can be used.

                        Thank you.
                        • 9. Re: FDM - Load two locations with same file via Batch Loader.
                          746471
                          Thankx

                          But could you give an example considering this case.

                          Nick
                          • 10. Re: FDM - Load two locations with same file via Batch Loader.
                            657263
                            Nick,

                            There ar eplenty of examples in the Workbench under the "Object Browser > Accellerator > Text File I/O"
                            These include: Copy, Read, Write, Delete, Open, Open and Append, etc.

                            Hopefully these will help and can be used as a baseline.

                            Thank you,
                            • 11. Re: FDM - Load two locations with same file via Batch Loader.
                              629764
                              Agreed!!! Just to avoid confusion in the script preferred DOS Batch Script.

                              Satya
                              • 12. Re: FDM - Load two locations with same file via Batch Loader.
                                657263
                                SatyaK,

                                While your script works for you it might not work for others. Please keep in mind that "drive letters" as you demonstrate in your script are not recommended and is noted in the FDM Documentation.

                                It states that you are to use a UNC Path name. This is because if implementations have two machines the drive letters aren't always going to be the same. Folder Paths can only exist on "one machine" when you use drive letters.... hence the documentation mentions UNC Path (FileShares) because then it is a universal point from anywhere.

                                Thank you,
                                • 13. Re: FDM - Load two locations with same file via Batch Loader.
                                  629764
                                  user743339 - Good Catch!!! Script specified is just an example... :)
                                  • 14. Re: FDM - Load two locations with same file via Batch Loader.
                                    Varun Kaushal
                                    Thankx it is really helpful. I am trying the same in case if i face any problems i will post the same.

                                    Nick
                                    1 2 Назад Вперед