Answered Questions

  • how do you split a file data into multiple files?

    explain with example?

    Star Read Best Answer

    Editorial / Best Answer

    jjtharappel  

    • Member Since Nov-2011 | Nov 24th, 2011


    Run a JCL with the below sort step

    Code
    1. //STEP1    EXEC PGM=SORT                            
    2. //SORTIN   DD DSN=input-file-name,DISP=SHR          
    3. //SORTOF01 DD DSN=output-file-name-1,          
    4. //            DISP=(NEW,CATLG,DELETE),              
    5. //            SPACE=...
    6. //            LRECL=...,RECFM=FB    
    7. //SORTOF02 DD DSN=output-file-name-2,          
    8. //            DISP=(NEW,CATLG,DELETE),              
    9. //            SPACE=...
    10. //            LRECL=...,RECFM=FB                    
    11. //SORTOF03 DD DSN=output-file-name-3,          
    12. //            DISP=(NEW,CATLG,DELETE),              
    13. //            SPACE=...
    14. //            LRECL=...,RECFM=FB                        
    15. //SYSOUT   DD SYSOUT=*                              
    16. //SYSIN    DD *                                      
    17.   SORT FIELDS=COPY                                        
    18.   OUTFIL FNAMES=SORTOF01,                                
    19.    INCLUDE=(cond for file 1)  
    20.   OUTFIL FNAMES=SORTOF02,                                
    21.    INCLUDE=(cond for file 2)  
    22.   OUTFIL FNAMES=SORTOF03,                                
    23.    INCLUDE=(cond for file 3)
    24. /*
    25. //*
    26.  

    Haribabu

    • Oct 15th, 2019

    SORT FIELDS=COPY
    OUTFIL FILES=OUT1,ENDREC=10000
    OUTFIL FILES=02,STARTREC=10001,ENDREC=20000 OUTFIL FILES=03,STARTREC=20001,ENDREC=30000

    also possible for OUTFIL FNAMES=(OUT1,OUT2,OUT3),SPLIT=10000

    Rishu

    • Jul 31st, 2014

    In addition to the above solution, we can use SPLIT BY in SORT. But it will depend on condition of split.

  • Write an algorithm to find the minimum of numbers where N is any arbitary natural number. N is given to you by the user as the first value.

  • There are numbers from 1 to N in an array. out of these, one of the number gets duplicated and one is missing. The task is to find out the duplicate number. Conditions: you have to do it in O(n) time without using any auxilary space (array, bitsets, maps etc..).

    Star Read Best Answer

    Editorial / Best Answer

    Answered by: David Rachutin

    • Dec 27th, 2006


    use the following method:

    mark the missing number as M and the duplicated as D

    1) compute the sum of regular list of numbers from 1 to N call it RegularSum

    2) compute the sum of your array (the one with M and D) call it MySum

    now you know that MySum-M+D=RegularSum

    this is one equation.

    the second one uses multiplication:

    3) compute the multiplication of numbers of regular list of numbers from 1 to N call it RegularMultiplication

    4) compute the multiplication of numbers of your list  (the one with M and D) call it MyMultiplication

    now you know that MyMultiplication=RegularMultiplication*D/M

    at this point you have two equations with two parameters, solve and rule!

    bakesh

    • Mar 16th, 2015

    9