View previous topic :: View next topic
|
Author |
Message |
balimanja
New User
Joined: 14 Aug 2007 Posts: 40 Location: Bangalore
|
|
|
|
Hi ALL,
The problem I am facing now is as follows:
There are two fields/cols in a file. The requirement demands that if the second field is present then insert a hyphen between the two fields, else output the number as it is.
E.g.:
Code: |
FIELD1 FIELD2 REQ.OUTPUT
100 A 100-A
1234 TER 1234-TER
6543 PUT 6543-PUT
3984 3984
|
Here Field1 is 8 char in length and Field2 is 4 char in length.
I believe IFTHEN needs to be used but I am new to SORT/SYNCTOOL.
THANK YOU ALL for your time on this. |
|
Back to top |
|
 |
ashokm
New User
Joined: 28 Feb 2006 Posts: 11 Location: Chennai,India
|
|
|
|
Hi Balimanja,
Here the JCL :
//SPLIT1R EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=XXXXX.ICE.INPUT,DISP=SHR
//SORTOUT DD DSN=XXXXX..ICE.OUTPUT,DISP=SHR
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(1,12,SQZ=(SHIFT=LEFT,PREBLANK=C' '))
/*
Ashok M |
|
Back to top |
|
 |
murmohk1
Senior Member
.jpg)
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
ashokm,
Quote: |
I believe IFTHEN needs to be used but I am new to SORT/SYNCTOOL. |
Your solution uses ICEMAN (DFSORT product). But the original post says balimanja needs a solution using syncsort. |
|
Back to top |
|
 |
balimanja
New User
Joined: 14 Aug 2007 Posts: 40 Location: Bangalore
|
|
|
|
Thanks Murali & Ashok
Ashok,
I tried your code but I am getting a syntax error.
Code: |
OPTION COPY
INREC OVERLAY=(1,12,SQZ=(SHIFT=LEFT,PREBLANK=C' '))
* |
Need help,
Thanks again |
|
Back to top |
|
 |
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
balimanja,
If your shop contains a SYNCSORT product, try with the following code.
The following code works fine for non-spaces values of field-1
Code: |
// EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
100 A
1234 TER
6543 PUT
3984
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
OPTION COPY
INREC IFTHEN=(WHEN=(9,4,CH,EQ,C' '),BUILD=(1,8)),
IFTHEN=(WHEN=(8,1,CH,NE,C' '),BUILD=(1,8,C'-',9,4)),
IFTHEN=(WHEN=(7,1,CH,NE,C' '),BUILD=(1,7,C'-',9,4)),
IFTHEN=(WHEN=(6,1,CH,NE,C' '),BUILD=(1,6,C'-',9,4)),
IFTHEN=(WHEN=(5,1,CH,NE,C' '),BUILD=(1,5,C'-',9,4)),
IFTHEN=(WHEN=(4,1,CH,NE,C' '),BUILD=(1,4,C'-',9,4)),
IFTHEN=(WHEN=(3,1,CH,NE,C' '),BUILD=(1,3,C'-',9,4)),
IFTHEN=(WHEN=(2,1,CH,NE,C' '),BUILD=(1,2,C'-',9,4)),
IFTHEN=(WHEN=(1,1,CH,NE,C' '),BUILD=(1,1,C'-',9,4))
OUTFIL IFOUTLEN=80 |
Output:
Code: |
100-A
1234-TER
6543-PUT
3984 |
If your post relates to a SYNCSORT, please post under JCL forum. This area is for DFSORT/ICETOOL and not for SYNCSORT. |
|
Back to top |
|
 |
ashokm
New User
Joined: 28 Feb 2006 Posts: 11 Location: Chennai,India
|
|
|
|
Hi,
That JCL removes all the spaces.This is one what you expect .
//SPLIT1R EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=XXXXX.ICE.INPUT,DISP=SHR
//SORTOUT DD DSN=XXXX.ICE.OUTPUT,DISP=SHR
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,12,SQZ=(SHIFT=LEFT,MID=C'-'))
/*
Ashok M |
|
Back to top |
|
 |
stodolas
Active Member

Joined: 13 Jun 2007 Posts: 631 Location: Wisconsin
|
|
|
|
murmohk1: When execute ICEMAN in my shop, it is an alias for SYNCTOOL. |
|
Back to top |
|
 |
balimanja
New User
Joined: 14 Aug 2007 Posts: 40 Location: Bangalore
|
|
|
|
Shankar,
The code you posted, is it complete? I am getting error. Please let me know.
Thank you |
|
Back to top |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
balimanja wrote: |
The code you posted, is it complete? I am getting error. Please let me know. |
It would help greatly if you posted the sysout with the error. Very few here a that good at mind reading....  |
|
Back to top |
|
 |
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
balimanja
The code i posted was ran successfully with syncsort for z/os 1.2.3 |
|
Back to top |
|
 |
Aaru
Senior Member

Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
There is no /* after the instream data. Else, Please post the error info. |
|
Back to top |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Aaru wrote: |
There is no /* after the instream data. |
Huh?  |
|
Back to top |
|
 |
Aaru
Senior Member

Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
CICS Guy,
That was a Typo  |
|
Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Ashok,
I tried your code but I am getting a syntax error. |
SQZ is a DFSORT function. It is NOT supported by Syncsort. |
|
Back to top |
|
 |
balimanja
New User
Joined: 14 Aug 2007 Posts: 40 Location: Bangalore
|
|
|
|
Shankar/Frank,
Isn't there any alternative? |
|
Back to top |
|
 |
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
balimanja,
Quote: |
The code you posted, is it complete? I am getting error. Please let me know. |
The code i posted was ran successfully with syncsort for z/os 1.2.3.
If you face any problem with that code, please post the full sysout messages that starts from SYSIN.
Quote: |
Isn't there any alternative? |
The before posted frank words are true.
If i find anything which fulfill your requirements, i will come up with the code. |
|
Back to top |
|
 |
balimanja
New User
Joined: 14 Aug 2007 Posts: 40 Location: Bangalore
|
|
|
|
Thank You Shankar,
Here is what I get:
Code: |
SYSIN :
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
*
OPTION COPY
INREC IFTHEN=(WHEN=(9,4,CH,EQ,C' '),BUILD=(1,8)),
IFTHEN=(WHEN=(8,1,CH,NE,C' '),BUILD=(1,8,C'-',9,4)),
IFTHEN=(WHEN=(7,1,CH,NE,C' '),BUILD=(1,7,C'-',9,4)),
IFTHEN=(WHEN=(6,1,CH,NE,C' '),BUILD=(1,6,C'-',9,4)),
IFTHEN=(WHEN=(5,1,CH,NE,C' '),BUILD=(1,5,C'-',9,4)),
IFTHEN=(WHEN=(4,1,CH,NE,C' '),BUILD=(1,4,C'-',9,4)),
IFTHEN=(WHEN=(3,1,CH,NE,C' '),BUILD=(1,3,C'-',9,4)),
IFTHEN=(WHEN=(2,1,CH,NE,C' '),BUILD=(1,2,C'-',9,4)),
IFTHEN=(WHEN=(1,1,CH,NE,C' '),BUILD=(1,1,C'-',9,4))
OUTFIL IFOUTLEN=80
SORT FIELDS=COPY
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE |
By the way, why is there an asterisk present in the end of the column margin?? |
|
Back to top |
|
 |
balimanja
New User
Joined: 14 Aug 2007 Posts: 40 Location: Bangalore
|
|
|
|
Disregard the SORT FIELDS=COPY statement it was added by mistake. |
|
Back to top |
|
 |
balimanja
New User
Joined: 14 Aug 2007 Posts: 40 Location: Bangalore
|
|
|
|
Shankar,
It is working great. The problem was with the column margin present after the SYSIN DD *.
Thank You.
and Thanks to Ashok, Frank and to all who replied. |
|
Back to top |
|
 |
|
|