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

Build single output from multiple inputs


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

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Wed Feb 23, 2011 1:55 pm
Reply with quote

Please find below my reqmt:
Input files :LRECL 133 FB
XXXX.file1.data
XXXX.file2.data
XXXX.file3.data
File content
Code:
XXXX.file1.data
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
                 WRITTEN 00000008                                               
                 DELETED 00000005                                                 
XXXX.file2.data
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
                 WRITTEN 00000058                                               
                 DELETED 00000000                                                 
XXXX.file3.data
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
                 WRITTEN 00000658                                               
                 DELETED 00000000     

Output file :
LRECL 80 FB
File name Rec count

Code:
DATE : 2011-02-22 or any date format
XXXX.file1.data : WRITTEN - 00000008 DELETED 00000005 ( OR ZERO SUPPRESSED)
XXXX.file2.data : WRITTEN - 00000058 DELETED 00000000
XXXX.file3.data : WRITTEN - 00000658 DELETED 00000000


Can anyone help me to acheive the result in SORT.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Feb 24, 2011 12:09 am
Reply with quote

Is

XXXX.file1.data

a record in the input file, or is it just the name of the dsname for that file?

DFSORT cannot obtain the dsname for a file automatically. You would have to specify it somehow. Given that, do you still want me to show you how to do this with DFSORT's GROUP function?
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Thu Feb 24, 2011 7:56 am
Reply with quote

Thanks Frank, I will try with GROUP function.
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Thu Mar 03, 2011 2:03 pm
Reply with quote

Hi Frank/Radhakrishnan,
Would you be able to show me how this can be achieved without using a ICETOOL step with only a GROUP for this scenario, please? I have a similar requirement where I would have to accomplish this in a single step but not using ICETOOL.

Thanks,
Ashwin.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Mar 03, 2011 8:49 pm
Reply with quote

Hello,

By now you should know you need to post some sample input and the output you want from the sample input (not necessarily complete records, but only the relevant fields). You also should mention the recfm and lrecl of the files. Post the "rules" for getting from the input to the output.

If someone is to spend time doing this for you, you need to at least provide info about what you want to accomplish. . .
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 03, 2011 11:32 pm
Reply with quote

Quote:
I have a similar requirement where I would have to accomplish this in a single step but not using ICETOOL.


Why?
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Fri Mar 04, 2011 1:03 pm
Reply with quote

Hi Dick/Frank,
I agree. But I thought I will try to extrapolate if someone showed me how it can be done for this particular scenario.
Anyway, I will provide my case here..

I have a file which has blocks of two records as in the example below. First record has to be compared with the second record. The comparision has to be between the delimiter values. The comparision result has to be the third record on the output. If it has a mismatch, we would have a 'Y', else it would be spaces as in the example below. Finally, the last record in the report will give us the count of 'Y' (mismatch values) columnwise. Here, when I say columnwise, it means each value between the delimiters. There are 25 such colums on my report, but I have mentioned only 3 in the sample below for the ease of explaining. Each column is about 10 bytes long. The LRECL=292 and RECFM=FB.

Input:
Code:

BEFORE  IMG:-    000100000 ¦BALAJI   ¦DATA
AFTER  IMG:-      000100000 ¦ARNOLD ¦DATA
BEFORE  IMG:-    000200000 ¦XXXXXX ¦DATA
AFTER  IMG:-      000200000 ¦XXXXXX ¦DATA1
BEFORE  IMG:-    000300000 ¦XXXXX1 ¦DATA2
AFTER  IMG:-      000300000 ¦XXXXX1 ¦DATA2


Output:
Code:


BEFORE  IMG:-    000100000 ¦BALAJI   ¦DATA
AFTER  IMG:-      000100000 ¦ARNOLD ¦DATA
MISMATCH IND:-                 ¦  Y
BEFORE  IMG:-    000200000 ¦XXXXXX ¦DATA
AFTER  IMG:-      000200000 ¦XXXXXX ¦DATA1
MISMATCH IND:-                 ¦             ¦   Y
BEFORE  IMG:-    000300000 ¦XXXXX1 ¦DATA2
AFTER  IMG:-      000300000 ¦XXXXX1 ¦DATA2
MISMATCH IND:-                 ¦             ¦   
MISMATCH TOT:-      0         ¦   1        ¦   1




Quote:

Why?


My folks here are against me using a ICETOOL solution whenever I comeup with one. But they are okay with a SORT solution and so I thought I will use this post as a template and try to build mine without a ICETOOL. Moreover, I had posted my ICETOOL solution here but it was deleted which I thought was correct as the solution was requested in SORT and not ICETOOL.

Please let me know your comments

Thanks,
Ashwin.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Mar 05, 2011 2:20 am
Reply with quote

I suspect JOINKEYS and lots of IFTHEN statements would be required to do this.

Are the fields actually in fixed positions in each record? For example, field 1 is always in positions 18-27, field2 is always in positions 29-35, and so on? If so, please give the starting position and length of each field.

Or can each field actually be variable length and delimited? If so, give the maximum length of each field.

Where do you want the 'Y' in each column? First character? Last character? Or what? Where do you want the total in each column and how long should it be?

Please run this job and show the //SYSOUT messages you receive, so I can see what level you're at:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DUMMY
//SYSIN    DD    *
    OPTION COPY
/*
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Mon Mar 07, 2011 5:54 pm
Reply with quote

Hi Frank,
I think I possibly found a solution when I tried to build it based on your solution in

Quote:
ibmmainframes.com/about53667.html


First of all, I will try to answer your questions.

Quote:

Are the fields actually in fixed positions in each record? For example, field 1 is always in positions 18-27, field2 is always in positions 29-35, and so on? If so, please give the starting position and length of each field.

The fields are all in fixed positions. I think the data got misaligned on this page when I submitted here. Each of the columns are 10 bytes long and their starting positions are 18, 29 and 40 respectively for the First, second and third columns.
Quote:

Where do you want the 'Y' in each column? First character? Last character? Or what?

The 'Y's have to be almost at the middle of each delimited field. This also has to be delimited.
Quote:

Where do you want the total in each column and how long should it be?

The totals has to be the trailing record, giving the totals column wise and the number should be almost in the middle of each delimited field.
Quote:

Please run this job and show the //SYSOUT messages you receive, so I can see what level you're at:


Code:

SYSIN :                                                                       
    OPTION COPY                                                         0000980
WER276B  SYSDIAG= 11205082, 16502744, 16502744, 5676075                       
WER164B  6,884K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,             
WER164B     0 BYTES RESERVE REQUESTED, 272K BYTES USED                         
WER146B  32K BYTES OF EMERGENCY SPACE ALLOCATED                               
WER108I  SORTIN   : RECFM=FB   ; LRECL=    80; BLKSIZE=    80                 
WER110I  SORTOUT  : RECFM=FB   ; LRECL=    80; BLKSIZE=    80                 
WER410B  5,856K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,       
WER410B     0 BYTES RESERVE REQUESTED, 156K BYTES USED                         
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
WER416B  BSAM WAS USED FOR SORTIN                                             
WER416B  BSAM WAS USED FOR SORTOUT                                             
WER054I  RCD IN          1, OUT          1                                     
WER169I  RELEASE 1.3 BATCH 0494 TPF LEVEL 2.0                                 
WER052I  END SYNCSORT - A491815B,S1,,DIAG=A000,6244,8806,00C4,E8FA,4CCB,8A08,86


This is how my control card looks like when I tried to build it for a LRECL=80, RECFM=FB.

Code:

//S1 EXEC PGM=SORT                         
//SYSOUT DD SYSOUT=*                       
//SORTIN DD *                               
BEFORE  IMG:-    000100000 ¦BALAJI     ¦DATA
AFTER   IMG:-     000100000 ¦ARNOLD    ¦DATA
BEFORE  IMG:-    000200000 ¦XXXXXX    ¦DATA
AFTER   IMG:-     000200000 ¦XXXXXX    ¦DATA1
BEFORE  IMG:-    000300000 ¦XXXXX1    ¦DATA2
AFTER   IMG:-     000300000 ¦XXXXX1    ¦DATA2
//SORTOUT DD  SYSOUT=*
//SYSIN DD *                                                       
  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,13,CH,EQ,C'BEFORE  IMG:-'),     
                      RECORDS=2,PUSH=(200:SEQ=1)),                 
   IFTHEN=(WHEN=(200,1,ZD,EQ,2),                                   
                BUILD=(81:1,80,200:200,1,260:C'¦',271:C'¦',350:C'0',
                       361:C'0',372:C'0'))                         
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(200,1,ZD,EQ,1),                 
                RECORDS=2,PUSH=(1:1,80)),                           
   IFTHEN=(WHEN=(18,10,CH,NE,98,10,CH),                             
                OVERLAY=(250:C'     Y    ',350:C'1'),HIT=NEXT),     
   IFTHEN=(WHEN=(29,10,CH,NE,109,10,CH),                           
                OVERLAY=(261:C'     Y    ',361:C'1'),HIT=NEXT),     
   IFTHEN=(WHEN=(40,10,CH,NE,120,10,CH),                           
                OVERLAY=(272:C'     Y    ',372:C'1'))               
   OUTFIL FNAMES=SORTOUT,INCLUDE=(200,1,ZD,EQ,2),REMOVECC,         
          TRAILER1=(1:C'MISMATCH TOT:-',                           
                   22:TOT=(350,1,ZD,M10,LENGTH=2),28:C'¦',         
                   33:TOT=(361,1,ZD,M10,LENGTH=2),39:C'¦',         
                   44:TOT=(372,1,ZD,M10,LENGTH=2),           
                   80:X),                                     
         BUILD=(1,80,/,81,80,/,C'MISMATCH IND:-',3X,250,32)   



Please let me know your comments..

Thanks,
Ashwin.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Mon Mar 07, 2011 6:54 pm
Reply with quote

The "WER" in your messages indicate that you are using SYNCSORT, not DFSORT. This question should be asked in the JCL forum.

Garry.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Mar 07, 2011 8:15 pm
Reply with quote

Topic moved.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Mar 07, 2011 9:00 pm
Reply with quote

Hello,

At the top of the informational output generated (above the messages) the release is shown. It will probably help someone help you if you post this line also.
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

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Grouping by multiple headers DFSORT/ICETOOL 7
Search our Forums:

Back to Top