MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Adding to a sort to make it comma delimited

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
newcobol
Beginner


Joined: 20 Apr 2006
Posts: 88
Topics: 22

PostPosted: Mon Apr 14, 2014 10:30 am    Post subject: Adding to a sort to make it comma delimited Reply with quote

I have 2 sort cards working together to sort sum and turn input file into display data. I am tasked to make this also comma delimited. typically this is done in the cobol program putting " at beginning of file, and " and end of file, and comma between each field. does anyone know how to add to my sort card to do this. here are the two cards.
Code:

FPRO-SOURCE-CD,001,02,CH
FPRO-PROD-NO,003,09,CH
FPRO-LAST-TRAN-CD,012,01,CH
FPRO-ACCT-QTR,013,02,BI
FPRO-ACCT-YR,015,02,BI
FPRO-REPORTNG-BRANCH,017,03,CH
FPRO-PRODUCNG-BRANCH,020,03,CH
FPRO-CURRENCY-CODE,023,03,CH
FPRO-REG-PRODUCNG,026,02,CH
FPRO-SRCE-AGGR-PRDCT,028,06,CH
FPRO-PRODUCT-SEGMENT,034,15,CH
FPRO-ADAT-AGGR-PRDT,049,50,CH
FPRO-PROFIT-CNTER-DESC,099,50,CH
FPRO-PRINT-LINE-DESC,149,50,CH
FPRO-POL-COUNT,199,04,BI
FPRO-CASH_PD_AM,203,09,PD
FPRO-CASH_PD_ORIG_AM,212,09,PD
FPRO-EXPN_PD_AM,221,09,PD
FPRO-EXPN_PD_ORIG_AM,230,09,PD
FPRO-REIN_CASH_PD_FAC_AM,239,09,PD
FPRO-REIN_CASH_PD_ORIG_FAC_AM,248,09,PD
FPRO-REIN_CASH_PD_CORP_AM,257,09,PD
FPRO-REIN_CASH_PD_ORIG_CORP_AM,266,09,PD
FPRO-REIN_EXPN_PD_FAC_AM,275,09,PD
FPRO-REIN_EXPN_PD_ORIG_FAC_AM,284,09,PD
FPRO-REIN_EXPN_PD_CORP_AM,293,09,PD
FPRO-REIN_EXPN_PD_ORIG_CORP_AM,302,09,PD
FPRO-CASH_PD_RSRV_OPEN_AM,311,09,PD
FPRO-CASH_PD_RSRV_OPEN_ORIG_AM,320,09,PD
FPRO-CASH_PD_RSRV_CLOS_AM,329,09,PD
FPRO-CASH_PD_RSRV_CLOS_ORIG_AM,338,09,PD
FPRO-EXPN_PD_RSRV_OPEN_AM,347,09,PD
FPRO-EXPN_PD_RSRV_OPEN_ORIG_AM,356,09,PD
FPRO-EXPN_PD_RSRV_CLOS_AM,365,09,PD
FPRO-EXPN_PD_RSRV_CLOS_ORIG_AM,374,09,PD
REIO_CASH_PD_RSRV_OPEN_FAC_AM,383,09,PD
REIO_CASH_PD_RSRV_CLOS_FAC_AM,392,09,PD
REIO_CASH_PD_RSRV_OPEN_CORP_AM,401,09,PD
REIO_CASH_PD_RSRV_CLOS_CORP_AM,410,09,PD
REIO_EXPN_PD_RSRV_OPEN_FAC_AM,419,09,PD
REIO_EXPN_PD_RSRV_CLOS_FAC_AM,428,09,PD
REIO_EXPN_PD_RSRV_OPEN_CORP_AM,437,09,PD
REIO_EXPN_PD_RSRV_CLOS_CORP_AM,446,09,PD

that first card gives a name to the fields. then u refer to the name in the next card:
Code:

SORT,FIELDS=(FPRO-SOURCE-CD,A,
             FPRO-PROD-NO,A,
             FPRO-LAST-TRAN-CD,A,
             FPRO-ACCT-QTR,A,
             FPRO-ACCT-YR,A,
             FPRO-REPORTNG-BRANCH,A,
             FPRO-PRODUCNG-BRANCH,A,
             FPRO-CURRENCY-CODE,A,
             FPRO-REG-PRODUCNG,A,
             FPRO-SRCE-AGGR-PRDCT,A,
             FPRO-PRODUCT-SEGMENT,A,
             FPRO-ADAT-AGGR-PRDT,A,
             FPRO-PROFIT-CNTER-DESC,A,
             FPRO-PRINT-LINE-DESC,A)
SUM FIELDS=(FPRO-POL-COUNT,
            FPRO-CASH_PD_AM,
            FPRO-CASH_PD_ORIG_AM,
            FPRO-EXPN_PD_AM,
            FPRO-EXPN_PD_ORIG_AM,
            FPRO-REIN_CASH_PD_FAC_AM,
            FPRO-REIN_CASH_PD_ORIG_FAC_AM,
            FPRO-REIN_CASH_PD_CORP_AM,
            FPRO-REIN_CASH_PD_ORIG_CORP_AM,
            FPRO-REIN_EXPN_PD_FAC_AM,
            FPRO-REIN_EXPN_PD_ORIG_FAC_AM,
            FPRO-REIN_EXPN_PD_CORP_AM,
            FPRO-REIN_EXPN_PD_ORIG_CORP_AM,
            FPRO-CASH_PD_RSRV_OPEN_AM,
            FPRO-CASH_PD_RSRV_OPEN_ORIG_AM,
            FPRO-CASH_PD_RSRV_CLOS_AM,
            FPRO-CASH_PD_RSRV_CLOS_ORIG_AM,
            FPRO-EXPN_PD_RSRV_OPEN_AM,
            FPRO-EXPN_PD_RSRV_OPEN_ORIG_AM,
            FPRO-EXPN_PD_RSRV_CLOS_AM,
            FPRO-EXPN_PD_RSRV_CLOS_ORIG_AM,
            REIO_CASH_PD_RSRV_OPEN_FAC_AM,
            REIO_CASH_PD_RSRV_CLOS_FAC_AM,
            REIO_CASH_PD_RSRV_OPEN_CORP_AM,
            REIO_CASH_PD_RSRV_CLOS_CORP_AM,
            REIO_EXPN_PD_RSRV_OPEN_FAC_AM,
            REIO_EXPN_PD_RSRV_CLOS_FAC_AM,
            REIO_EXPN_PD_RSRV_OPEN_CORP_AM,
            REIO_EXPN_PD_RSRV_CLOS_CORP_AM)
OUTREC FIELDS=(FPRO-SOURCE-CD,
        FPRO-PROD-NO,
        FPRO-LAST-TRAN-CD,
        FPRO-ACCT-QTR,EDIT=(T),
        FPRO-ACCT-YR,EDIT=(TTTT),
        FPRO-REPORTNG-BRANCH,
        FPRO-PRODUCNG-BRANCH,
        FPRO-CURRENCY-CODE,
        FPRO-REG-PRODUCNG,
        FPRO-SRCE-AGGR-PRDCT,
        FPRO-PRODUCT-SEGMENT,
        FPRO-ADAT-AGGR-PRDT,
        FPRO-PROFIT-CNTER-DESC,
        FPRO-PRINT-LINE-DESC,
        FPRO-POL-COUNT,EDIT=(TTTTTTTTT),
        FPRO-CASH_PD_AM,EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
        FPRO-CASH_PD_ORIG_AM,
                        EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
        FPRO-EXPN_PD_AM,
                        EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
        FPRO-EXPN_PD_ORIG_AM,
                        EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
        FPRO-REIN_CASH_PD_FAC_AM,
                        EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
        FPRO-REIN_CASH_PD_ORIG_FAC_AM,
                        EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
        FPRO-REIN_CASH_PD_CORP_AM,
                        EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
        FPRO-REIN_CASH_PD_ORIG_CORP_AM,
                        EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
FPRO-REIN_EXPN_PD_FAC_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
FPRO-REIN_EXPN_PD_ORIG_FAC_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
FPRO-REIN_EXPN_PD_CORP_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
FPRO-REIN_EXPN_PD_ORIG_CORP_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
FPRO-CASH_PD_RSRV_OPEN_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
FPRO-CASH_PD_RSRV_OPEN_ORIG_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
FPRO-CASH_PD_RSRV_CLOS_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
FPRO-CASH_PD_RSRV_CLOS_ORIG_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
FPRO-EXPN_PD_RSRV_OPEN_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
FPRO-EXPN_PD_RSRV_OPEN_ORIG_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
FPRO-EXPN_PD_RSRV_CLOS_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
FPRO-EXPN_PD_RSRV_CLOS_ORIG_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
REIO_CASH_PD_RSRV_OPEN_FAC_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
REIO_CASH_PD_RSRV_CLOS_FAC_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
REIO_CASH_PD_RSRV_OPEN_CORP_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
REIO_CASH_PD_RSRV_CLOS_CORP_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
REIO_EXPN_PD_RSRV_OPEN_FAC_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
REIO_EXPN_PD_RSRV_CLOS_FAC_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
REIO_EXPN_PD_RSRV_OPEN_CORP_AM,
                EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,),
REIO_EXPN_PD_RSRV_CLOS_CORP_AM,
               EDIT=(STTTTTTTTTTTTTTT.TT),SIGNS=('+','-',,))

what do i add in the outrec fields to make it comma delimited, the " at the beginning and end, and comma between the fields?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Mon Apr 14, 2014 10:55 am    Post subject: Reply with quote

newcobol,

Quite easy. Add the following symbols to your field definitions

Code:

BEGIN-QUOTE,C'"'     
END-QUOTE,C'"'       
COMMA,C','           


And then change your OUTREC statement as follows. Add the symbol COMMA after every field.

Code:

  OUTREC FIELDS=(BEGIN-QUOTE,             
                 FPRO-SOURCE-CD,           
                 COMMA,                   
                 FPRO-PROD-NO,             
                 COMMA,                   
                 FPRO-LAST-TRAN-CD,       
                 COMMA,
                 .....                   
                 END-QUOTE)               

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
newcobol
Beginner


Joined: 20 Apr 2006
Posts: 88
Topics: 22

PostPosted: Mon Apr 14, 2014 11:52 am    Post subject: Reply with quote

just got back here. i added the c'"' at the beginning and the end, and c',' in between the fields in the outrec only and it worked! thanks for the response.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group