Formatting using outrec



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Formatting using outrec

Postby venkmangav » Mon Dec 23, 2013 3:44 pm

below input file is having 2 segments 1.) department segment and 2.) employee income details segment.
If my file is having some 1000k records with the below format, i want to retreive only few employee details with the department and employee income segment details.
When i am trying with OUTREC statement, it is throwing error?
whether i can get my expected output with OUTREC ? could pls help me?

Input file structure:

(dept details) (empid)          (emp pf acc no)  (technology)
DEPARTIT  1111111111111  1234567891234  MAINF     --->department segment
EMPINC     EPF      68.00                                             ---> employee income segment contains employee income details provident fund
EMPINC     EBA      10779.00                                             ---> employee income segment contains basic salary
DEPARTIT  2222222222222  1234567891234  MAINF   
EMPINC     EPF      68.00
EMPINC     EBA      79.00
DEPARTIT  3333333333333  1234567891234  MAINF   
EMPINC     EPF      68.00
EMPINC     EBA      79.00
EMPINC     EBO     80.00
DEPARTIT  4444444444444  1234567891234  NET   
EMPINC     EPF      68.00
EMPINC     EBA      79.00
DEPARTIT  555555555555  1234567891234  JAVA   
EMPINC     EPF      68.00
EMPINC     EBA      79.00


Expected OUTPUT FILE: ( i need only few employee details)

DEPARTIT  3333333333333  1234567891234  MAINF   
EMPINC     EPF      68.00
EMPINC     EBA      79.00
EMPINC     EBO     80.00
DEPARTIT  4444444444444  1234567891234  NET   
EMPINC     EPF      68.00
EMPINC     EBA      79.00


//SYSIN DD *                                                   
    OPTION COPY                                                 
    OUTREC IFTHEN=(WHEN=(1,8,CH,EQ,C'DEPARTIT'),AND,           
                         (9,13,EDW,C'3333333333333'),OR,               
                         (9,13,EDW,C'4444444444444'), -         
             BUILD=(1,8,2X,9,13,2X,24,13,2X,57,6)),             
           IFTHEN=(WHEN=(1,6,CH,EQ,C'EMPINC'), -               
             BUILD=(1,8,2X,11,5,2X,20,5) 
/*   
venkmangav
 
Posts: 10
Joined: Wed Oct 30, 2013 3:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Formatting using outrec

Postby BillyBoyo » Mon Dec 23, 2013 4:35 pm

What do you think EDW is? You don't have enough parentheses, the "-" is probably unproblematic, but you should be aware that it is treated as a comment and could equally be anything.

There may be more, but you'd have to show the sysout from the step, as I'm not going to bother to process the cards in my head on the offchance of hitting what you think the problem is.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Formatting using outrec

Postby venkmangav » Mon Dec 23, 2013 5:02 pm

Sorry it was typo mistake, below is updated sort card,

//SYSIN DD *                                                   
    OPTION COPY                                                 
    OUTREC IFTHEN=(WHEN=(1,8,CH,EQ,C'DEPARTIT'),AND,           
                         (9,13,EQ,C'3333333333333'),OR,               
                         (9,13,EQ,C'4444444444444'), -         
             BUILD=(1,8,2X,9,13,2X,24,13,2X,57,6)),             
           IFTHEN=(WHEN=(1,6,CH,EQ,C'EMPINC'), -               
             BUILD=(1,8,2X,11,5,2X,20,5) 
/*
venkmangav
 
Posts: 10
Joined: Wed Oct 30, 2013 3:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Formatting using outrec

Postby BillyBoyo » Mon Dec 23, 2013 5:13 pm

Please show the sysout from the step so that we can see the error. It is much easier than us imagining...

Also, with your AND and OR and OR, explain in words what you want, so that we can see how it should be further (to the problem) parenthesised if necessary.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Formatting using outrec

Postby venkmangav » Mon Dec 23, 2013 5:35 pm

Hi, below is the error i am getting

SYSIN :                                                 
    OPTION COPY                                         
    OUTREC IFTHEN=(1,8,CH,EQ,C'DEPARTIT'),AND,   
                                               *       
                          (9,13,EQ,C'3333333333333'),OR,               
                         (9,13,EQ,C'4444444444444'), -         
             BUILD=(1,8,2X,9,13,2X,24,13,2X,57,6)),             
           IFTHEN=(WHEN=(1,6,CH,EQ,C'EMPINC'), -               
             BUILD=(1,8,2X,11,5,2X,20,5) )               
WER268A  OUTREC STATEMENT  : SYNTAX ERROR               
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


I need only selected employees department segment and employee income segment details,
From the input file i need empid 3333333333333 or 4444444444444 data i.e, department and corresponding employee income segment details.
venkmangav
 
Posts: 10
Joined: Wed Oct 30, 2013 3:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Formatting using outrec

Postby BillyBoyo » Mon Dec 23, 2013 6:15 pm

OK, thanks. You have SyncSort (WER messages) so the topic will be moved shortly to the SyncSort part of the forum.

The code you showed earlier is different from the code giving you that error.

IFTHEN=(WHEN= is a necessary start for an IFTHEN.

For IFTHEN=(WHEN=(logical expression) the entire logical expession must be enclosed in parentheses.

You have the extraneous "-"s and also have made the final closing parenthesis into a comment, which will cause another syntax error when you get that far:

You don't have correct syntax for the 9,13 comparisons.

I suggest you try to put the code together bit-by-bit:

  OPTION COPY                                         
  INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'DEPARTIT'),   
             BUILD=(1,8,2X,9,13,2X,24,13,2X,57,6))


I've used INREC - without a SORT it is equivalent to OUTREC. You may have chosen OUTREC because you thought it had special properties.

Once that gives you the output format that you want, then you can look to extend the logical expression to limit the data.

Then you can consider the second IFTHEN and the second BUILD and ponder upon how you are going to get fixed-length records of different sizes (you aren't) or how to get the BUILDs the same size.

You have attempted to do everything at once, and have a large number of errors getting in the way of each other. Start simple.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post