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 

how can I achive this using SORT ?

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


Joined: 05 Oct 2005
Posts: 28
Topics: 20
Location: INDORE

PostPosted: Sun Apr 01, 2007 1:23 pm    Post subject: how can I achive this using SORT ? Reply with quote

Hi,
I am having an FB file with lrecl of 80.The i/p file looks like this.


Code:


EMP-NO               ST   ADR

1234567                1  aaaaaaa
1234567                2  aaabbbb
1234567                3  aaaaggg
1234568                1         
1234568                2  aaaaaaa
1234569                1  aaaaaaa
1234569                3  bbbbbbb



I need to produce the o/p like

Code:

EMP                       
1234567              1      y         2    y        3     y
1234568              1      n         2    y        3    n/a
1234569              1      y         2   n/a       3     y



The rules to get the output
1)Each EMP should appear as a single record in the o/p file.
2)There will be a max of 3 st codes (1 or 2 or 3) for each record.
3)Whenever the ADR field is blank(5 th record in i/p file) ,the output shoud have N where as if the ST code is not available then N should come.

Thanks in advance.

Tempuser.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Sun Apr 01, 2007 4:25 pm    Post subject: Reply with quote

tempuser,

Try this job

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD *                 
----+----1----+----2----+----3---
1234567                1  AAAAAAA
1234567                2  AAABBBB
1234567                3  AAAAGGG
1234568                1         
1234568                2  AAAAAAA
1234569                1  AAAAAAA
1234569                3  BBBBBBB
//SORTOUT  DD SYSOUT=* 
//SYSIN    DD *                                         
  SORT FIELDS=(01,07,CH,A)                             
  SUM FIELDS=(81,9,ZD)                                 
  INREC IFTHEN=(WHEN=INIT,                             
       OVERLAY=(81:9C'0')),                             
                                                       
        IFTHEN=(WHEN=(24,1,ZD,EQ,1,AND,27,1,CH,GT,C' '),
       OVERLAY=(81:C'1')),                             
                                                       
        IFTHEN=(WHEN=(24,1,ZD,EQ,1,AND,27,1,CH,EQ,C' '),
       OVERLAY=(82:C'1')),                             
                                                       
        IFTHEN=(WHEN=(24,1,ZD,EQ,2,AND,27,1,CH,GT,C' '),
       OVERLAY=(84:C'1')),                             
                                                       
        IFTHEN=(WHEN=(24,1,ZD,EQ,2,AND,27,1,CH,EQ,C' '),
       OVERLAY=(85:C'1')),                             
                                                       
        IFTHEN=(WHEN=(24,1,ZD,EQ,3,AND,27,1,CH,GT,C' '),
       OVERLAY=(87:C'1')),                             
                                                       
        IFTHEN=(WHEN=(24,1,ZD,EQ,3,AND,27,1,CH,EQ,C' '),
       OVERLAY=(88:C'1'))                               
                                                       
  OUTREC IFTHEN=(WHEN=(81,2,ZD,EQ,10),                 
        OVERLAY=(81:C'Y  '),HIT=NEXT),                 
         IFTHEN=(WHEN=(81,2,ZD,EQ,01),                 
        OVERLAY=(81:C'N  '),HIT=NEXT),                 
         IFTHEN=(WHEN=(81,2,ZD,EQ,00),                 
        OVERLAY=(81:C'N/A'),HIT=NEXT),                 
                                                       
         IFTHEN=(WHEN=(84,2,ZD,EQ,10),                 
        OVERLAY=(84:C'Y  '),HIT=NEXT),                 
         IFTHEN=(WHEN=(84,2,ZD,EQ,01),                 
        OVERLAY=(84:C'N  '),HIT=NEXT),                 
         IFTHEN=(WHEN=(84,2,ZD,EQ,00),                 
        OVERLAY=(84:C'N/A'),HIT=NEXT),                 
                                                       
         IFTHEN=(WHEN=(87,2,ZD,EQ,10),
        OVERLAY=(87:C'Y  '),HIT=NEXT),
         IFTHEN=(WHEN=(87,2,ZD,EQ,01),
        OVERLAY=(87:C'N  '),HIT=NEXT),
         IFTHEN=(WHEN=(87,2,ZD,EQ,00),
        OVERLAY=(87:C'N/A'),HIT=NEXT) 
                                       
  OUTFIL BUILD=(01,07,3X,             
                C'1',X,81,03,3X,       
                C'2',X,84,03,3X,       
                C'3',X,87,03,80:X)     
/*                                     


Hope this helps...

Cheers

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


Joined: 20 Sep 2006
Posts: 41
Topics: 12
Location: Venus

PostPosted: Thu Apr 19, 2007 9:33 am    Post subject: Reply with quote

Job abended with following message
WER268A INREC STATEMENT : SYNTAX ERROR
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER268A OUTFIL STATEMENT : SYNTAX ERROR
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Apr 19, 2007 9:44 am    Post subject: Reply with quote

you are running syncsort; kolusu's parms were for DFSORT. Don't know enough about syncsort to advise you on compatibility, but someone else on this board will.

maybe ask alissa margulies directly, she is mvsforums board member: amargulies

http://www.mvsforums.com/helpboards/profile.php?mode=viewprofile&u=6544
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Thu Apr 19, 2007 12:33 pm    Post subject: Reply with quote

anita_m,

Support for IFTHEN, OVERLAY, and BUILD was built into SyncSort for z/OS 1.2.1.0 and later. What release of SyncSort are you currently running?
_________________
Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
anita_m
Beginner


Joined: 20 Sep 2006
Posts: 41
Topics: 12
Location: Venus

PostPosted: Thu Apr 19, 2007 2:16 pm    Post subject: Reply with quote

Following is what I see in sysout...

SYNCSORT FOR Z/OS 1.1DR TPF3 U.S. PATENTS: 4210961, 5117495 (C) 2002 SYNC

z/OS 1.4.0
Back to top
View user's profile Send private message
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Thu Apr 19, 2007 3:39 pm    Post subject: Reply with quote

Quote:
SYNCSORT FOR Z/OS 1.1DR TPF3

Ah, that is the reason for the syntax error... support for these features is not available in the older release of SyncSort.

As an existing licensed SyncSort for z/OS customer, it's a free upgrade from release 1.1 to 1.2.

If you have a SyncSort Online Customer Support Account, you can download SyncSort for z/OS 1.2 from https://www.syncsort.com/support/login.pl
If you would like to request an account or would prefer to receive an installation tape, you can simply call SyncSort Product Services at 201-930-8260 or email zos_tech@syncsort.com
_________________
Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
anita_m
Beginner


Joined: 20 Sep 2006
Posts: 41
Topics: 12
Location: Venus

PostPosted: Wed Apr 25, 2007 2:30 pm    Post subject: Reply with quote

Thank you
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