Alternate Source (Diverter) Setup

Phases of Diverter Setup

Create Diverter Supplier in K3S

Add the diverter to K3S as type Alternate Source.

Determine ‘Diverter Day’

Choose which day each week you would like the fresh diverter orders built.

Once the day is determine, adjust the K3S Processing Schedule accordingly.

Using CL program K3S_GETALT to Populate K3S files with Weekly Offerings

One method of getting the weekly offerings loaded into the appropriate K_ALTSRC* files is by setting up CL program K3S_GETALT in library K3S_5MOD.

Using this method requires the weekly offerings to be FTP’d to the IFS. Then program K3S_GETALT imports the data into a file and does a copy file to get the data into the appropriate K_ALTSRC* file.

Depending upon how the data looks that the diverter sends, you will either copy the data in the stream file to a physical file with defined fields or a flat 120 byte file.

First let’s look at what to do if the data sent from the diverter has different field lengths. Below is an example of diverter data from Supreme that has different field lengths; notice how the records don’t match up going down the page:

    ,00300258109310,100 CT EQUAL PACKETS,264,32.59,12
    ,00300258942672,4 OZ EQUAL SPOONFUL SWEETNER,210,20.60,8
    ,00305210014008,6.1 OZ PONDS COLD CREAM,122,54.00,24
    ,00305210179004,300 CT QTIPS SWAB ANTI MICROBI,512,41.50,24
    ,00305212352009,7.5 OZ VPJ JAR REG,64,81.60,48
    ,00305212384000,2.5 OZ VPJ TUB,126,70.40,48
    ,00305215128007,500 CT QTIPS COTTON SWABS,93,56.60,24
    ,00305215163282,375 CT QTIPS COTTON SWABS BONU,43,43.40,24
    ,00009800008247,12/24CT TIC TAC SPEARMINT SING,1,127.01,288
    ,00009800008292,12/24CT TIC TAC CITRUS TWIST S,34,127.01,288
    ,00009800123247,12/12CT FERRERO ROCHER 3 PC,14,93.51,144
    ,00309971185007,1.5 OZ LDY MITCHUM SHWR FRSH R,78,24.70,24
    ,00309972322104,1 CT RVLN SLANT TIP TWEEZER,24,99.50,72

The program K3S_GETALT will import the above data to a physical file. See example physical file below called SUPREME which resides in library K3S_5MOD.

    A          R RSUPREME                                            
    A            ITEM          10          COLHDG('Item#')           
    A            UPC           14          COLHDG('UPC')             
    A            DESC          30          COLHDG('Description')     
    A            QTYAVAIL       5  0       COLHDG('Qty' 'available') 
    A            PRICE          7  2       COLHDG('Price')           
    A            PACK           5  0       COLHDG('Pack')

Below is sample code from K3S_GETALT that will copy the data from stream file /KING/SUPREME.CSV and put it into physical file SUPREME. Then the data is copied from SUPREME into physical file K_ALTSRC01.

    /*** Supreme to K_ALTSRC01 ***********************************/                                                                    
             CPYFRMIMPF FROMSTMF('/king/supreme.csv') +                 
                          TOFILE(K3S_5MOD/SUPREME) MBROPT(*REPLACE) +   
                          RCDDLM(*ALL) DTAFMT(*DLM) STRDLM(*NONE) +     
             MONMSG     MSGID(CPF2817)                                  
             MONMSG     MSGID(CPFA0D4) EXEC(DO)                         
             GOTO       CMDLBL(NO_SUPREME)                              
             RMVLNK     OBJLNK('/KING/supreme.csv')                     
             MONMSG     MSGID(CPFA0A9)                                  
             CPYF       FROMFILE(K3S_5MOD/SUPREME) +                    
                          TOFILE(K3S_5DTA/K_ALTSRC01) +                 
                          MBROPT(*REPLACE) FMTOPT(*NOCHK)               
             MONMSG     MSGID(CPF2817)                                  
             CLRPFM     FILE(SUPREME)                                   

As a last step in K3S_GETALT the link /KING/SUPREME.CSV is removed in order to be ready for the next week’s offerings to be sent.

Now let’s look at another example where the diverter sends the data with matching fields lengths. Below is an example of diverter data from Quality King that has the same field lengths; notice how the records match up going down the page:

            UPC,DESCRIPTION                  ,ONHAND,   PRICE,
    07476492642,SURGI CRM MOUSSE HAIR REMV 5.85,00024,     .66
    85024100088,POWER STICK SH/GEL INTENSTY 12Z,02352,     .75
    85024100014,POWER STICK SH/GEL OLYMPIAN 12Z,02688,     .75
    85024100004,POWER STICK SHWR/GEL PPLINE 12Z,02640,     .75
    71525690021,QLTY ALCOHOL ISOPROPYL 50% 12 Z,27264,     .63
    71525690027,QLTY ALCOHOL WNTRGREN 50% 12 OZ,25512,     .63
    71525611001,QLTY WITCH HAZEL 16 OZ         ,02652,    1.44
    30074283800,FAULT EAR SYRINGE              ,00204,    1.36
    30074281401,FAULTLESS GOODHEALTH PREM BTTL ,03180,    3.46
    07007457513,ALIMENTUM ADV IRN RTF32 OZ CS/6,02382,    6.40
    07007440702,ENSURE PLUS 8OZ CHOC CS 4/6PKS ,05804,    8.07

Because the fields match up the program K3S_GETALT can import the above data to flat 120 byte file. See example below of this flat file called K_ALTSRC which resides in library K3S_5MOD.

      A          R RKALTSRC                  TEXT('Altsrc Work File')    
      A            DATA         120                                      

Below is sample code from K3S_GETALT that will copy the data from stream file /KING/QKING.CSV and put it into the flat file K_ALTSRC. Then the data is copied from K_ALTSRC into physical file K_ALTSRC02.

/***  Quality King to K_ALTSRC02   ***********************************/ 
              CPYFRMIMPF FROMSTMF('/king/qking.csv') +                   
                           TOFILE(K3S_5MOD/K_ALTSRC) +                   
                           MBROPT(*REPLACE) RCDDLM(*ALL) +               
                           DTAFMT(*DLM) STRDLM(*NONE) +                  
                           RMVBLANK(*NONE) FLDDLM(*TAB)                  
              MONMSG     MSGID(CPF2817 CPFA0D4) EXEC(DO)                 
              GOTO       CMDLBL(NO_QKING)                                
              RMVLNK     OBJLNK('/KING/qking.csv')                       
              CPYF       FROMFILE(K3S_5MOD/K_ALTSRC) +                   
                           TOFILE(K3S_5DTA/K_ALTSRC02) +                 
                           MBROPT(*REPLACE) FMTOPT(*NOCHK)               

Once again as a last step in K3S_GETALT the link /KING/QKING.CSV is removed in order to be ready for the next week’s offerings to be sent.

Program K3S_GETALT should be compiled to our activation group of K3S_ACTG_5.

Some customers choose to have K3S_GETALT called as a first step in program K3S_9110CL, which is the program that processes diverter orders in the night job. Be sure to compile K3S_9110CL into K3S_ACTG_5 as well.

The code below shows how the CALL to K3S_GETALT occurs right after the declaration of variables as the first step in program K3S_9110CL:

 /*      Count records to see if orders are to be built               */

              DCL        VAR(&REC_COUNT) TYPE(*DEC) LEN(9 0)                                                                                   

 /*-------------------------------- pull offerings from directory     */

 /*     get offerings from directory /KING                            */

              CALL       PGM(K3S_GETALT)                                                                                                       

Exclude updating product information for diverters

RPGLE program K3S_9000 is the typical program that builds the K3S interface file for products (K_INTPROD). Since diverter suppliers will have zero active products in the K3S system, we must add a statement in K3S_9000 to exclude building interface records for this type of supplier.

See example below where products have been excluded for three different Alternate Source suppliers.

 * --------------------------------------------------                                                                 
**   don't take products for alternate source suppliers            
c                   if        ip_supl = '41330  ' or                
c                             ip_supl = '39990  ' or                
c                             ip_supl = '37011  '                                  
c                   goto      end                                   
c                   endif                                           

Diverter file

There are 15 files available to use from file name K_ALTSRC01 through K_ALTSRC15. More files can be established if you will be buying from more than 15 sources. These files are located in library K3S_5DTA and are flat files with 80 bytes records. If this is the first Alternate Source Supplier you are setting up, then use the first file called K_ALTSRC01.

Most Alternate Source Suppliers send the offerings via email attachment or by using FTP to a site you designate. You will need to receive their offerings and then populate the appropriate K3S offering’s K_ALTSRCxx file.

The weekly Alternate Source process will use their offerings that make the cut off time, and then automatically clear the files for the next week’s process.

Victory Wholesale

Below is the typical layout of the offerings file from Victory Wholesale.


          001070080722 PAYDAY                        06336 000050  12   24.00CT     

871707    001070070230 JOLLY RANCHER ASSORTED PEG    01440 000128  12    7.00OZ     

          005210000248 MCCORMICK DILL SEED           00030 001491   6    0.85OZ     

          004180021800 WELCH PURPLE GRAPE JUICE-PLSTC00032 000240   8   46.00OZ      

          003900001893 ORTEGA TACO SAUCE-MILD        02160 000193  12   16.00OZ     

762344    007301021409 TAMPAX REGULAR   #24622       24000 000156  48   10.00CT     

222141    007301031409 TAMPAX SUPER                  24000 000156  48   10.00CT      

          004139000105 KIKKOMAN SOY SAUCE-LT         02592 000180  12   10.00OZ     

222133    007301041409 TAMPAX SUPER PLUS  #44628     24000 000155  48   10.00CT     

          005100014293 CAMPBELLS CHUNKY CHIX DUMPLING05952 000165  12   18.80OZ     

Field Descriptions

1-10 = customer product ID if known (10 characters)

11-22 = upc (12 characters)

23 = blank space (1 character)

24-53 = description (30 characters)

54-58= quantity available (5 characters)

59 = blank space (1 character)

60-65 = cost (6 characters)

66-69 = case pack (4 characters)

70-77 = not used by K3S (8 characters)

78-79 = not used by K3S (2 characters)

Quality King

Below is the typical layout of the offerings file from Quality King.


 ************Beginning of data**************                         

 THEIR#,        UPC,DESCRIPTION                  ,ONHAND,   PRICE,   

0000000081751301003,CANTU COCONUT CURLING CRM 12OZ ,00870,    4.34   

0000000085601700012,CANTU LEAVE-IN CND REPAIR 16OZ ,00510,    3.97   

0000000085601700004,CANTU SHEA BTTR GROW STRNG 6.1Z,00144,    2.98   

0000000085230800513,DERMABRUSH ANTI-AGING MOIST 1.7,08007,    2.26   

0000000088399110905,DERMABRUSH AUTOSHIP 20441AS    ,00109,   11.18   

0000000088399107221,DERMABRUSH B/SCRUB W/PPMT 6.7OZ,01130,    8.88   

0000000088399108030,DERMABRUSH CITRUS FCL CLNS 5 OZ,12519,    8.93   

Field Descriptions

1-8 = customer product ID if known (8 characters)

9-19 = upc (11 characters)

20 = comma separation (1 character)

21-51 = description (31 characters)

52 = comma separation (1 character)

53-57 = quantity available (5 characters)

58 = comma separation (1 character)

59-66 = cost with 2 decimal positions (8 characters)

We have a few customers using this format:


 ************Beginning of data**************                             

 THEIR#,        UPC,DESCRIPTION                  ,ONHAND,   PRICE        

00000000,72474200763,ALBA DEEP CLEAN ACNE WASH 6 OZ ,01038,    3.76      

00000000,72474200760,ALBA PORE ACNE WASH 6 OZ       ,00600,    3.60      

00000000,01910023456,BIORE BAKING SODA ACNE SCRB 4.5,00516,    3.72   

00000000,01910023457,BIORE CHARCOAL ACNE SCRB 4.5OZ ,03336,    3.82      

00000000,01910020742,BIORE CHARCOAL SCRUB BAR 3.77OZ,01500,    3.81      

00000000,01910020744,BIORE CHARCOL PORE MINMZR 3.1OZ,01296,    5.28      

00000000,01910020743,BIORE PORE CLNS CHARCOAL STPS 6,03372,    3.90  

Field Descriptions

1-8 = customer product ID if known (8 characters)

9 = comma separation (1 character)

10-20 = upc (11 characters)

21 = comma separation (1 character)

22-52 = description (31 characters)

53 = comma separation (1 character)

54-58 = quantity available (5 characters)

59 = comma separation (1 character)

60-67 = cost with 2 decimal positions (8 characters)