Extracting data from an input file using SORT to different output files not providing expected data










0















I am using SORT to process an input file and extract records that match three different criteria. The criteria is laid out in the control statements. I am looking for fields that match the text GROUND OPERATIONS, TECHNICAL OPERATI and AIRPORT TRANSFERS. I want records from the input that match each of the conditions to be written to a corresponding output file. The DDs for the output file are SORTOF01, SORTOF02 and SORTOF03 respectively.



I can see there are records that match my criteria in the input file but when executed the SORT completes but no records are selected. I’m missing something but I don’t know what it is. The JCL and control statements for the SORT are supplied below.



//PROB3 EXEC PGM=SORT 
//SORTIN DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON,DISP=SHR
//SORTOF01 DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLN01,
// DISP=(NEW,CATLG,DELETE),
// LIKE=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON
//SORTOF02 DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLN02,
// DISP=(NEW,CATLG,DELETE),
// LIKE=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON
//SORTOF03 DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLN03,
// DISP=(NEW,CATLG,DELETE),
// LIKE=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(93,3,CH,EQ,C'YES')
OUTFIL FILES=01,INCLUDE=(73,20,CH,EQ,C'GROUND OPERATIONS')
OUTFIL FILES=02,INCLUDE=(73,20,CH,EQ,C'TECHNICAL OPERATI')
OUTFIL FILES=03,INCLUDE=(73,20,CH,EQ,C'AIRPORT TRANSFERS')









share|improve this question



















  • 2





    Once again - this is not a JCL question so remove that tag. Putting JCL and SORT together as you have is senseless unless you are trying to sort some JCL or you require the JCL to execute the sort program. Whether it is a batch job or some other method of invocation the control statements are going to be the same. Which data set (not file) was empty? Maybe there were no records for that file. To put records into any of those data sets they must have YES in cols 93-95 and the relevant text in columns 73 to 92. And note that the strings that you are searching for are 17 bytes long not 20.

    – NicC
    Nov 15 '18 at 15:33






  • 2





    Try using a length of17, What is the data file you are copying, is it VB and have you adjusted the columns for that ??

    – Bruce Martin
    Nov 15 '18 at 19:27











  • Thanks martin for the response..its worked for me

    – Mahesh Kumar
    Nov 16 '18 at 11:08












  • @BruceMartin It would be good for you to provide your answer below. I edited the question to reflect @maheshKumar’s intent. Your answer is helpful. Hopefully Mahesh will respond and accept your answer

    – Hogstrom
    Nov 18 '18 at 14:58







  • 1





    Hogstrom it should be @NicC who answers; I will add an answer, Nic if you want to answer, I can delete my answer

    – Bruce Martin
    Nov 18 '18 at 20:28















0















I am using SORT to process an input file and extract records that match three different criteria. The criteria is laid out in the control statements. I am looking for fields that match the text GROUND OPERATIONS, TECHNICAL OPERATI and AIRPORT TRANSFERS. I want records from the input that match each of the conditions to be written to a corresponding output file. The DDs for the output file are SORTOF01, SORTOF02 and SORTOF03 respectively.



I can see there are records that match my criteria in the input file but when executed the SORT completes but no records are selected. I’m missing something but I don’t know what it is. The JCL and control statements for the SORT are supplied below.



//PROB3 EXEC PGM=SORT 
//SORTIN DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON,DISP=SHR
//SORTOF01 DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLN01,
// DISP=(NEW,CATLG,DELETE),
// LIKE=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON
//SORTOF02 DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLN02,
// DISP=(NEW,CATLG,DELETE),
// LIKE=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON
//SORTOF03 DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLN03,
// DISP=(NEW,CATLG,DELETE),
// LIKE=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(93,3,CH,EQ,C'YES')
OUTFIL FILES=01,INCLUDE=(73,20,CH,EQ,C'GROUND OPERATIONS')
OUTFIL FILES=02,INCLUDE=(73,20,CH,EQ,C'TECHNICAL OPERATI')
OUTFIL FILES=03,INCLUDE=(73,20,CH,EQ,C'AIRPORT TRANSFERS')









share|improve this question



















  • 2





    Once again - this is not a JCL question so remove that tag. Putting JCL and SORT together as you have is senseless unless you are trying to sort some JCL or you require the JCL to execute the sort program. Whether it is a batch job or some other method of invocation the control statements are going to be the same. Which data set (not file) was empty? Maybe there were no records for that file. To put records into any of those data sets they must have YES in cols 93-95 and the relevant text in columns 73 to 92. And note that the strings that you are searching for are 17 bytes long not 20.

    – NicC
    Nov 15 '18 at 15:33






  • 2





    Try using a length of17, What is the data file you are copying, is it VB and have you adjusted the columns for that ??

    – Bruce Martin
    Nov 15 '18 at 19:27











  • Thanks martin for the response..its worked for me

    – Mahesh Kumar
    Nov 16 '18 at 11:08












  • @BruceMartin It would be good for you to provide your answer below. I edited the question to reflect @maheshKumar’s intent. Your answer is helpful. Hopefully Mahesh will respond and accept your answer

    – Hogstrom
    Nov 18 '18 at 14:58







  • 1





    Hogstrom it should be @NicC who answers; I will add an answer, Nic if you want to answer, I can delete my answer

    – Bruce Martin
    Nov 18 '18 at 20:28













0












0








0








I am using SORT to process an input file and extract records that match three different criteria. The criteria is laid out in the control statements. I am looking for fields that match the text GROUND OPERATIONS, TECHNICAL OPERATI and AIRPORT TRANSFERS. I want records from the input that match each of the conditions to be written to a corresponding output file. The DDs for the output file are SORTOF01, SORTOF02 and SORTOF03 respectively.



I can see there are records that match my criteria in the input file but when executed the SORT completes but no records are selected. I’m missing something but I don’t know what it is. The JCL and control statements for the SORT are supplied below.



//PROB3 EXEC PGM=SORT 
//SORTIN DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON,DISP=SHR
//SORTOF01 DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLN01,
// DISP=(NEW,CATLG,DELETE),
// LIKE=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON
//SORTOF02 DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLN02,
// DISP=(NEW,CATLG,DELETE),
// LIKE=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON
//SORTOF03 DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLN03,
// DISP=(NEW,CATLG,DELETE),
// LIKE=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(93,3,CH,EQ,C'YES')
OUTFIL FILES=01,INCLUDE=(73,20,CH,EQ,C'GROUND OPERATIONS')
OUTFIL FILES=02,INCLUDE=(73,20,CH,EQ,C'TECHNICAL OPERATI')
OUTFIL FILES=03,INCLUDE=(73,20,CH,EQ,C'AIRPORT TRANSFERS')









share|improve this question
















I am using SORT to process an input file and extract records that match three different criteria. The criteria is laid out in the control statements. I am looking for fields that match the text GROUND OPERATIONS, TECHNICAL OPERATI and AIRPORT TRANSFERS. I want records from the input that match each of the conditions to be written to a corresponding output file. The DDs for the output file are SORTOF01, SORTOF02 and SORTOF03 respectively.



I can see there are records that match my criteria in the input file but when executed the SORT completes but no records are selected. I’m missing something but I don’t know what it is. The JCL and control statements for the SORT are supplied below.



//PROB3 EXEC PGM=SORT 
//SORTIN DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON,DISP=SHR
//SORTOF01 DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLN01,
// DISP=(NEW,CATLG,DELETE),
// LIKE=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON
//SORTOF02 DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLN02,
// DISP=(NEW,CATLG,DELETE),
// LIKE=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON
//SORTOF03 DD DSN=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLN03,
// DISP=(NEW,CATLG,DELETE),
// LIKE=XXX.T.KR0Z1N99.RU02.FTPGEN.THOTLNON
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(93,3,CH,EQ,C'YES')
OUTFIL FILES=01,INCLUDE=(73,20,CH,EQ,C'GROUND OPERATIONS')
OUTFIL FILES=02,INCLUDE=(73,20,CH,EQ,C'TECHNICAL OPERATI')
OUTFIL FILES=03,INCLUDE=(73,20,CH,EQ,C'AIRPORT TRANSFERS')






mainframe dfsort






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 17:58









Hogstrom

1,5311416




1,5311416










asked Nov 15 '18 at 14:07









Mahesh KumarMahesh Kumar

112




112







  • 2





    Once again - this is not a JCL question so remove that tag. Putting JCL and SORT together as you have is senseless unless you are trying to sort some JCL or you require the JCL to execute the sort program. Whether it is a batch job or some other method of invocation the control statements are going to be the same. Which data set (not file) was empty? Maybe there were no records for that file. To put records into any of those data sets they must have YES in cols 93-95 and the relevant text in columns 73 to 92. And note that the strings that you are searching for are 17 bytes long not 20.

    – NicC
    Nov 15 '18 at 15:33






  • 2





    Try using a length of17, What is the data file you are copying, is it VB and have you adjusted the columns for that ??

    – Bruce Martin
    Nov 15 '18 at 19:27











  • Thanks martin for the response..its worked for me

    – Mahesh Kumar
    Nov 16 '18 at 11:08












  • @BruceMartin It would be good for you to provide your answer below. I edited the question to reflect @maheshKumar’s intent. Your answer is helpful. Hopefully Mahesh will respond and accept your answer

    – Hogstrom
    Nov 18 '18 at 14:58







  • 1





    Hogstrom it should be @NicC who answers; I will add an answer, Nic if you want to answer, I can delete my answer

    – Bruce Martin
    Nov 18 '18 at 20:28












  • 2





    Once again - this is not a JCL question so remove that tag. Putting JCL and SORT together as you have is senseless unless you are trying to sort some JCL or you require the JCL to execute the sort program. Whether it is a batch job or some other method of invocation the control statements are going to be the same. Which data set (not file) was empty? Maybe there were no records for that file. To put records into any of those data sets they must have YES in cols 93-95 and the relevant text in columns 73 to 92. And note that the strings that you are searching for are 17 bytes long not 20.

    – NicC
    Nov 15 '18 at 15:33






  • 2





    Try using a length of17, What is the data file you are copying, is it VB and have you adjusted the columns for that ??

    – Bruce Martin
    Nov 15 '18 at 19:27











  • Thanks martin for the response..its worked for me

    – Mahesh Kumar
    Nov 16 '18 at 11:08












  • @BruceMartin It would be good for you to provide your answer below. I edited the question to reflect @maheshKumar’s intent. Your answer is helpful. Hopefully Mahesh will respond and accept your answer

    – Hogstrom
    Nov 18 '18 at 14:58







  • 1





    Hogstrom it should be @NicC who answers; I will add an answer, Nic if you want to answer, I can delete my answer

    – Bruce Martin
    Nov 18 '18 at 20:28







2




2





Once again - this is not a JCL question so remove that tag. Putting JCL and SORT together as you have is senseless unless you are trying to sort some JCL or you require the JCL to execute the sort program. Whether it is a batch job or some other method of invocation the control statements are going to be the same. Which data set (not file) was empty? Maybe there were no records for that file. To put records into any of those data sets they must have YES in cols 93-95 and the relevant text in columns 73 to 92. And note that the strings that you are searching for are 17 bytes long not 20.

– NicC
Nov 15 '18 at 15:33





Once again - this is not a JCL question so remove that tag. Putting JCL and SORT together as you have is senseless unless you are trying to sort some JCL or you require the JCL to execute the sort program. Whether it is a batch job or some other method of invocation the control statements are going to be the same. Which data set (not file) was empty? Maybe there were no records for that file. To put records into any of those data sets they must have YES in cols 93-95 and the relevant text in columns 73 to 92. And note that the strings that you are searching for are 17 bytes long not 20.

– NicC
Nov 15 '18 at 15:33




2




2





Try using a length of17, What is the data file you are copying, is it VB and have you adjusted the columns for that ??

– Bruce Martin
Nov 15 '18 at 19:27





Try using a length of17, What is the data file you are copying, is it VB and have you adjusted the columns for that ??

– Bruce Martin
Nov 15 '18 at 19:27













Thanks martin for the response..its worked for me

– Mahesh Kumar
Nov 16 '18 at 11:08






Thanks martin for the response..its worked for me

– Mahesh Kumar
Nov 16 '18 at 11:08














@BruceMartin It would be good for you to provide your answer below. I edited the question to reflect @maheshKumar’s intent. Your answer is helpful. Hopefully Mahesh will respond and accept your answer

– Hogstrom
Nov 18 '18 at 14:58






@BruceMartin It would be good for you to provide your answer below. I edited the question to reflect @maheshKumar’s intent. Your answer is helpful. Hopefully Mahesh will respond and accept your answer

– Hogstrom
Nov 18 '18 at 14:58





1




1





Hogstrom it should be @NicC who answers; I will add an answer, Nic if you want to answer, I can delete my answer

– Bruce Martin
Nov 18 '18 at 20:28





Hogstrom it should be @NicC who answers; I will add an answer, Nic if you want to answer, I can delete my answer

– Bruce Martin
Nov 18 '18 at 20:28












1 Answer
1






active

oldest

votes


















2














Try changing the length from 20 to 17 as below



//SYSIN DD * 
SORT FIELDS=COPY
INCLUDE COND=(93,3,CH,EQ,C'YES')
OUTFIL FILES=01,INCLUDE=(73,17,CH,EQ,C'GROUND OPERATIONS')
OUTFIL FILES=02,INCLUDE=(73,17,CH,EQ,C'TECHNICAL OPERATI')
OUTFIL FILES=03,INCLUDE=(73,17,CH,EQ,C'AIRPORT TRANSFERS')


Comparing 20 bytes with 17 bytes is probably going to be false




When having problems with sort, Always check the Record-Format, if the RECFM is VB you need to add 4 to all positions






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53321258%2fextracting-data-from-an-input-file-using-sort-to-different-output-files-not-prov%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    Try changing the length from 20 to 17 as below



    //SYSIN DD * 
    SORT FIELDS=COPY
    INCLUDE COND=(93,3,CH,EQ,C'YES')
    OUTFIL FILES=01,INCLUDE=(73,17,CH,EQ,C'GROUND OPERATIONS')
    OUTFIL FILES=02,INCLUDE=(73,17,CH,EQ,C'TECHNICAL OPERATI')
    OUTFIL FILES=03,INCLUDE=(73,17,CH,EQ,C'AIRPORT TRANSFERS')


    Comparing 20 bytes with 17 bytes is probably going to be false




    When having problems with sort, Always check the Record-Format, if the RECFM is VB you need to add 4 to all positions






    share|improve this answer



























      2














      Try changing the length from 20 to 17 as below



      //SYSIN DD * 
      SORT FIELDS=COPY
      INCLUDE COND=(93,3,CH,EQ,C'YES')
      OUTFIL FILES=01,INCLUDE=(73,17,CH,EQ,C'GROUND OPERATIONS')
      OUTFIL FILES=02,INCLUDE=(73,17,CH,EQ,C'TECHNICAL OPERATI')
      OUTFIL FILES=03,INCLUDE=(73,17,CH,EQ,C'AIRPORT TRANSFERS')


      Comparing 20 bytes with 17 bytes is probably going to be false




      When having problems with sort, Always check the Record-Format, if the RECFM is VB you need to add 4 to all positions






      share|improve this answer

























        2












        2








        2







        Try changing the length from 20 to 17 as below



        //SYSIN DD * 
        SORT FIELDS=COPY
        INCLUDE COND=(93,3,CH,EQ,C'YES')
        OUTFIL FILES=01,INCLUDE=(73,17,CH,EQ,C'GROUND OPERATIONS')
        OUTFIL FILES=02,INCLUDE=(73,17,CH,EQ,C'TECHNICAL OPERATI')
        OUTFIL FILES=03,INCLUDE=(73,17,CH,EQ,C'AIRPORT TRANSFERS')


        Comparing 20 bytes with 17 bytes is probably going to be false




        When having problems with sort, Always check the Record-Format, if the RECFM is VB you need to add 4 to all positions






        share|improve this answer













        Try changing the length from 20 to 17 as below



        //SYSIN DD * 
        SORT FIELDS=COPY
        INCLUDE COND=(93,3,CH,EQ,C'YES')
        OUTFIL FILES=01,INCLUDE=(73,17,CH,EQ,C'GROUND OPERATIONS')
        OUTFIL FILES=02,INCLUDE=(73,17,CH,EQ,C'TECHNICAL OPERATI')
        OUTFIL FILES=03,INCLUDE=(73,17,CH,EQ,C'AIRPORT TRANSFERS')


        Comparing 20 bytes with 17 bytes is probably going to be false




        When having problems with sort, Always check the Record-Format, if the RECFM is VB you need to add 4 to all positions







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 18 '18 at 20:33









        Bruce MartinBruce Martin

        8,18211632




        8,18211632





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53321258%2fextracting-data-from-an-input-file-using-sort-to-different-output-files-not-prov%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Top Tejano songwriter Luis Silva dead of heart attack at 64

            ReactJS Fetched API data displays live - need Data displayed static

            政党