IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

File formatting using SORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat May 23, 2009 12:29 pm
Reply with quote

surya4ug,

I have slightly modified Kolusu's code to make it work for you.
Code:
//SYSIN      DD *
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,50,100C'0',61,10,SFF,ZD,LENGTH=10,
        161:SEQNUM,2,ZD)),
        IFTHEN=(WHEN=(1,9,CH,EQ,C'ATTRIBUTE'),
        OVERLAY=(163:SEQNUM,2,ZD),HIT=NEXT),
        IFTHEN=(WHEN=(1,9,CH,NE,C'ATTRIBUTE'),
        OVERLAY=(165:SEQNUM,2,ZD,163:161,2,ZD,SUB,165,2,ZD,M11,
        LENGTH=2),HIT=NEXT),
        IFTHEN=(WHEN=(163,2,ZD,EQ,01),OVERLAY=(051:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,02),OVERLAY=(061:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,03),OVERLAY=(071:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,04),OVERLAY=(081:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,05),OVERLAY=(091:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,06),OVERLAY=(101:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,07),OVERLAY=(111:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,08),OVERLAY=(121:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,09),OVERLAY=(131:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,10),OVERLAY=(141:151,10),HIT=NEXT)
        SORT FIELDS=(1,50,CH,A),EQUALS                                       
        SUM FIELDS=(051,10,061,10,071,10,081,10,091,10,                       
               101,10,111,10,121,10,131,10,141,10),FORMAT=ZD

        OUTFIL OMIT=(1,9,CH,EQ,C'ATTRIBUTE'),REMOVECC,                       
        BUILD=(1,50,                                                         
         070:051,10,ZD,M10,LENGTH=10,082:061,10,ZD,M10,LENGTH=10,       
         093:071,10,ZD,M10,LENGTH=10,104:081,10,ZD,M10,LENGTH=10,       
         115:091,10,ZD,M10,LENGTH=10,126:101,10,ZD,M10,LENGTH=10,       
         137:111,10,ZD,M10,LENGTH=10,148:121,10,ZD,M10,LENGTH=10,       
         159:131,10,ZD,M10,LENGTH=10,170:141,10,ZD,M10,LENGTH=10,       
         181:051,10,ZD,ADD,061,10,ZD,ADD,071,10,ZD,ADD,                 
             081,10,ZD,ADD,091,10,ZD,ADD,101,10,ZD,ADD,                 
             111,10,ZD,ADD,121,10,ZD,ADD,131,10,ZD,ADD,                 
             141,10,ZD,M10,LENGTH=12),                                 
        HEADER1=(070:'MISMATCHES FROM 10 FILES',/,                           
           001:'ATTRIBUTE ',070:'FILE01 VAL',082:'FILE02 VAL',         
           093:'FILE03 VAL',104:'FILE04 VAL',115:'FILE05 VAL',         
           126:'FILE06 VAL',137:'FILE07 VAL',148:'FILE08 VAL',         
           159:'FILE09 VAL',170:'FILE10 VAL',181:7X,'TOTAL')
Back to top
View user's profile Send private message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Sat May 23, 2009 1:40 pm
Reply with quote

Perfect! Its working again. Thanks much!!

here are my final 2 requirements ( the % division part was also successful )

1) The constant is obtained as an output of one of the upstream jobs to the current job. Is there a way to provide it as a dynamic input and have the TOTAL divided by it and eventually multiply by 100

2) I want to append the current day to the header

Ex : MISMATCHES FROM 10 FILES2009-05-23

Is there a function in SYNCSORT that can accomplish this.

Thanks in advance.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat May 23, 2009 1:59 pm
Reply with quote

You're welcome. icon_smile.gif

1) Yes. Is it residing in a file? If yes, how do we extract it from it?
2) Yes.
Back to top
View user's profile Send private message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Sat May 23, 2009 9:55 pm
Reply with quote

Yes it is residing in a file.

a) Is there a function that Can append the value thats present in the CONSTANT file to the TOTAL file, right at the end in the last column

b) then have the TOTAL field divided by the appended field and then multiply by 100
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat May 23, 2009 10:04 pm
Reply with quote

surya4ug,

From whatever you have posted so far,

You have a "constant" file from which you extract a numeric value. Is it having only a single record? If there are multiple records, is there any way to identify/extract the numeric constant? Post here some sample data from your constant file using "Code" tags. Also the RECFM/LRECL etc.
Back to top
View user's profile Send private message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Sat May 23, 2009 11:04 pm
Reply with quote

Hmm..the constant file will look like :

Code:
Total no of input records : 1234567890
Total no of adds                      :          82509
Total no of changes                 :       6582954
Total no of deletes                   :       6486130



We need to pick the value 6582954 from
Code:
Total no of changes        :       6582954
and append it to our original TOTAL file and proceed with dividing the TOTAL field with the constant and eventually multiply by 100.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sun May 24, 2009 9:35 am
Reply with quote

Can this particular record be identified by "Total no of changes" at Pos 1-19?
What about the Starting position, Length and Format of the numeric field?
Back to top
View user's profile Send private message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Sun May 24, 2009 10:34 am
Reply with quote

Lets consider this case:

Total no. of change records (1-27 )
Constant : (35-45) -> numeric

Code:
Total no. of change records  :     6758920522
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sun May 24, 2009 11:58 am
Reply with quote

Hello,

See the latest job as per your "final version" of the requirement. This is untested. Try it out and post back if you come across any issues.
Code:

//STEP1    EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD DSN= Constant file                             
//SORTOUT  DD DSN=&&S1,DISP=(,PASS)         
//SYSIN    DD *                             
  INCLUDE COND=(1,27,CH,EQ,C'Total no. of change records')             
  INREC BUILD=(C'CONST,+',35,11,UFF,ZD,LENGTH=11,80:X)
  SORT FIELDS=COPY                           
//STEP2    EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD DSN=Your input file 01,DISP=SHR
//         DD DSN=Your input file 02,DISP=SHR
//         DD DSN=Your input file 03,DISP=SHR
//         DD DSN=Your input file 04,DISP=SHR
//         DD DSN=Your input file 05,DISP=SHR
//         DD DSN=Your input file 06,DISP=SHR
//         DD DSN=Your input file 07,DISP=SHR
//         DD DSN=Your input file 08,DISP=SHR
//         DD DSN=Your input file 09,DISP=SHR
//         DD DSN=Your input file 10,DISP=SHR                             
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,50,100C'0',61,10,SFF,ZD,LENGTH=10,
        161:SEQNUM,2,ZD)),
        IFTHEN=(WHEN=(1,9,CH,EQ,C'ATTRIBUTE'),
        OVERLAY=(163:SEQNUM,2,ZD),HIT=NEXT),
        IFTHEN=(WHEN=(1,9,CH,NE,C'ATTRIBUTE'),
        OVERLAY=(165:SEQNUM,2,ZD,163:161,2,ZD,SUB,165,2,ZD,M11,
        LENGTH=2),HIT=NEXT),
        IFTHEN=(WHEN=(163,2,ZD,EQ,01),OVERLAY=(051:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,02),OVERLAY=(061:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,03),OVERLAY=(071:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,04),OVERLAY=(081:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,05),OVERLAY=(091:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,06),OVERLAY=(101:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,07),OVERLAY=(111:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,08),OVERLAY=(121:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,09),OVERLAY=(131:151,10),HIT=NEXT),                 
        IFTHEN=(WHEN=(163,2,ZD,EQ,10),OVERLAY=(141:151,10),HIT=NEXT)
        SORT FIELDS=(1,50,CH,A),EQUALS                                       
        SUM FIELDS=(051,10,061,10,071,10,081,10,091,10,                       
               101,10,111,10,121,10,131,10,141,10),FORMAT=ZD
        OUTFIL OMIT=(1,9,CH,EQ,C'ATTRIBUTE'),REMOVECC,                       
        BUILD=(1,50,                                                         
         070:051,10,ZD,M10,LENGTH=10,082:061,10,ZD,M10,LENGTH=10,       
         093:071,10,ZD,M10,LENGTH=10,104:081,10,ZD,M10,LENGTH=10,       
         115:091,10,ZD,M10,LENGTH=10,126:101,10,ZD,M10,LENGTH=10,       
         137:111,10,ZD,M10,LENGTH=10,148:121,10,ZD,M10,LENGTH=10,       
         159:131,10,ZD,M10,LENGTH=10,170:141,10,ZD,M10,LENGTH=10,       
         181:051,10,ZD,ADD,061,10,ZD,ADD,071,10,ZD,ADD,                 
             081,10,ZD,ADD,091,10,ZD,ADD,101,10,ZD,ADD,                 
             111,10,ZD,ADD,121,10,ZD,ADD,131,10,ZD,ADD,                 
             141,10,ZD,M10,LENGTH=12,
         194:(051,10,ZD,ADD,061,10,ZD,ADD,071,10,ZD,ADD,                 
             081,10,ZD,ADD,091,10,ZD,ADD,101,10,ZD,ADD,                 
             111,10,ZD,ADD,121,10,ZD,ADD,131,10,ZD,ADD,                 
             141,10,ZD),MUL,+100,DIV,CONST,M10,LENGTH=12, C' %'),                                 
        HEADER1=(070:'MISMATCHES FROM 10 FILES',/,                           
           001:'ATTRIBUTE ',070:'FILE01 VAL',082:'FILE02 VAL',         
           093:'FILE03 VAL',104:'FILE04 VAL',115:'FILE05 VAL',         
           126:'FILE06 VAL',137:'FILE07 VAL',148:'FILE08 VAL',         
           159:'FILE09 VAL',170:'FILE10 VAL',181:7X,'TOTAL',
           194:7X,'PERCENT') 
Back to top
View user's profile Send private message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Sun May 24, 2009 1:03 pm
Reply with quote

Thanks Arun. Before i try this, could you please add the piece of code to append the current date (YY-MM-DD) to the header. that i requested previously

It should be right beside "'MISMATCHES FROM 10 FILES''.

Ex :
Code:
MISMATCHES FROM 10 FILES2009-05-24
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sun May 24, 2009 1:25 pm
Reply with quote

Try replacing the below part
Code:
HEADER1=(070:'MISMATCHES FROM 10 FILES',/,
by
Code:
HEADER1=(070:'MISMATCHES FROM 10 FILES',DATE1(-),/,
Back to top
View user's profile Send private message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Sun May 24, 2009 2:36 pm
Reply with quote

Arun,

It throws an error : CONTINUATION STATEMENT ERROR FOUND

Code:
HEADER1=(070:'**********PERSONAL PROFILE FIELD-LEVEL STATS',DATE1(-))
Back to top
View user's profile Send private message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Sun May 24, 2009 3:06 pm
Reply with quote

Hi Arun,

I used &DATE and it worked....icon_smile.gif
Code:


Input:
---------
HEADER1=(001:'**********PERSONAL PROFILE FIELD-LEVEL STATS',&DATE)


Output
---------

Code:
**********PERSONAL PROFILE FIELD-LEVEL STATS05/24/09
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sun May 24, 2009 3:20 pm
Reply with quote

You might try this
Code:
&DATE(-)
if you need to change the default separator.
Back to top
View user's profile Send private message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Sun May 24, 2009 11:09 pm
Reply with quote

hmm... even &DATE(-) is throwing an error.


Code:
HEADER1=(001:'**********PERSONAL PROFILE FIELD-LEVEL STATS',&DATE(-))

Code:
WER274A  CONTINUATION STATEMENT ERROR FOUND
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Mon May 25, 2009 5:21 am
Reply with quote

Hello,

If "I used &DATE and it worked.", is there still something that needs to be done?

I seem to have confused myself. . . icon_rolleyes.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon May 25, 2009 10:04 am
Reply with quote

Quote:
hmm... even &DATE(-) is throwing an error
See the correct syntax for dates below.
YY-MM-DD
Code:
HEADER1=(070:'MISMATCHES FROM 10 FILES',&DATE=(YMD-),/,                           
         001:'ATTRIBUTE ',070:'FILE01 VAL',082:'FILE02 VAL',         
................
................)

YYYY-MM-DD
Code:
HEADER1=(070:'MISMATCHES FROM 10 FILES',&DATE=(4MD-),/,                           
         001:'ATTRIBUTE ',070:'FILE01 VAL',082:'FILE02 VAL',         
................
................)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM Goto page Previous  1, 2

 


Similar Topics
Topic Forum Replies
No new posts Help with SORT - I need to validate d... DFSORT/ICETOOL 1
No new posts Unable to interpret a hex value to De... COBOL Programming 7
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
Search our Forums:

Back to Top