|
View previous topic :: View next topic
|
| Author |
Message |
bshkris
New User
Joined: 21 Mar 2005 Posts: 41 Location: pune
|
|
|
|
Hello,
I was trying using IF THEN & OVERLAY. But didn't succeeded.
Requirement:
Input file:
1121003 2020-09-23T15:21:16-05:00 #Error:
1121003 -------------------------------------------------
1121003 Driver Files Does not exist
1121003 -------------------------------------------------
2609111 2020-10-11T15:21:16-05:00 #Error:
2609111 -------------------------------------------------
2609111 Driver Files Does not exist
2609111 -------------------------------------------------
2609112 2020-10-12T15:21:16-05:00 #Error:
2609112 -------------------------------------------------
2609112 Driver Files Does not exist
Output:
The timestamp value must be copied from above record and placed in 2nd rec for same group id(first 7bytes field)
1121003 2020-09-23T15:21:16-05:00 #Error:
1121003 2020-09-23T15:21:16-05:00 -----------------
1121003 2020-09-23T15:21:16-05:00 Driver Files Does not exist
1121003 2020-09-23T15:21:16-05:00 -----------------
2609111 2020-10-11T15:21:16-05:00 #Error:
2609111 2020-10-11T15:21:16-05:00 ----------------
2609111 2020-10-11T15:21:16-05:00 Driver Files Does not exist
2609111 2020-10-11T15:21:16-05:00 -----------------
2609112 2020-10-12T15:21:16-05:00 #Error:
2609112 2020-10-12T15:21:16-05:00 ----------------
2609112 2020-10-12T15:21:16-05:00 Driver Files Does not exist
2609112 2020-10-12T15:21:16-05:00 ----------------
Can any one please help me in getting the above output.
tried in many ways using IFTHEN method but didn't get the expected one. |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
A) Why have you not used the code tags?
B) Why have you not shown the control statements that did not work? Without them we do not know what you tried and therefore we do not know how to fix them. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
It’s been 15 years for you on the forum and don’t use the code tags. In your last post I requested you to use it but you did not act on that , this is another post and you did the same . Going forward go to the Rules on the top section and it is explained how to use the code tags.
Similar question has been asked so many times in past , did you search before posting if not then please do some research and you will get the answer why it’s not working.
There is something exists called IFTHEN=GROUP,KEYBEGIN=(),.. PUSH=() use that and BUILD the record in next IFTHEN.
Or use a JOINKEYS and reformat. |
|
| Back to top |
|
 |
bshkris
New User
Joined: 21 Mar 2005 Posts: 41 Location: pune
|
|
|
|
Apologies for not using Code tags, just did it in hurry.
Will provide my code which is not working , still doing research on this.
Thanks. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2272 Location: USA
|
|
|
|
| bshkris wrote: |
Apologies for not using Code tags, just did it in hurry.
Will provide my code which is not working , still doing research on this.
Thanks. |
1. As long as no code is presented here you cannot expect any help from the forum.
2. You have no time in your “hurry” to demonstrate your problem in a clear and accurate manner. Why do you suppose others do have more of their own time to help you? |
|
| Back to top |
|
 |
bshkris
New User
Joined: 21 Mar 2005 Posts: 41 Location: pune
|
|
|
|
| Code: |
1121003 2020-09-23T15:21:16-05:00 #Error:
1121003 -------------------------------------------------
1121003 Driver Files Does not exist
1121003 -------------------------------------------------
2609111 2020-10-11T15:21:16-05:00 #Error:
2609111 -------------------------------------------------
2609111 Driver Files Does not exist
2609111 -------------------------------------------------
2609112 2020-10-12T15:21:16-05:00 #Error:
2609112 -------------------------------------------------
2609112 Driver Files Does not exist
Output:
The timestamp value must be copied from above record and placed in 2nd rec for same group id(first 7bytes field)
1121003 2020-09-23T15:21:16-05:00 #Error:
1121003 2020-09-23T15:21:16-05:00 -----------------
1121003 2020-09-23T15:21:16-05:00 Driver Files Does not exist
1121003 2020-09-23T15:21:16-05:00 -----------------
2609111 2020-10-11T15:21:16-05:00 #Error:
2609111 2020-10-11T15:21:16-05:00 ----------------
2609111 2020-10-11T15:21:16-05:00 Driver Files Does not exist
2609111 2020-10-11T15:21:16-05:00 -----------------
2609112 2020-10-12T15:21:16-05:00 #Error:
2609112 2020-10-12T15:21:16-05:00 ----------------
2609112 2020-10-12T15:21:16-05:00 Driver Files Does not exist
2609112 2020-10-12T15:21:16-05:00 ---------------- |
|
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2272 Location: USA
|
|
|
|
Where is your code?
People can point to your mistakes, but not do your own job instead of you.
Hint: you need to use IFTHEN=(WHEN=GROUP option. |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1430 Location: Bamberg, Germany
|
|
|
|
Must be hard to code an INREC and three IFTHEN statements to achieve the desired result. This request is for the Beginners Forum.  |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
I got some time to try this for you but next time please try yourself first and use code tags.
| Code: |
//SORTIN DD *
1121003 2020-09-23T15:21:16-05:00 #ERROR:
1121003 ---------------------------------------------
1121003 DRIVER FILES DOES NOT EXIST
1121003 ---------------------------------------------
2609111 2020-10-11T15:21:16-05:00 #ERROR:
2609111 ---------------------------------------------
2609111 DRIVER FILES DOES NOT EXIST
2609111 ---------------------------------------------
2609112 2020-10-12T15:21:16-05:00 #ERROR:
2609112 ---------------------------------------------
2609112 DRIVER FILES DOES NOT EXIST
//SORTOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,7),PUSH=(101:9,26)),
IFTHEN=(WHEN=(9,26,CH,EQ,101,26,CH),BUILD=(1,80)),
IFTHEN=(WHEN=(9,1,CH,EQ,C'-'),BUILD=(1,8,101,26,35,20)),
IFTHEN=(WHEN=NONE,BUILD=(1,8,101,26,9,46)) |
Output-
| Code: |
********************************* TOP OF DATA **********************************
1121003 2020-09-23T15:21:16-05:00 #ERROR:
1121003 2020-09-23T15:21:16-05:00 -------------------
1121003 2020-09-23T15:21:16-05:00 DRIVER FILES DOES NOT EXIST
1121003 2020-09-23T15:21:16-05:00 -------------------
2609111 2020-10-11T15:21:16-05:00 #ERROR:
2609111 2020-10-11T15:21:16-05:00 -------------------
2609111 2020-10-11T15:21:16-05:00 DRIVER FILES DOES NOT EXIST
2609111 2020-10-11T15:21:16-05:00 -------------------
2609112 2020-10-12T15:21:16-05:00 #ERROR:
2609112 2020-10-12T15:21:16-05:00 -------------------
2609112 2020-10-12T15:21:16-05:00 DRIVER FILES DOES NOT EXIST
******************************** BOTTOM OF DATA ******************************** |
|
|
| Back to top |
|
 |
bshkris
New User
Joined: 21 Mar 2005 Posts: 41 Location: pune
|
|
|
|
Thanks Rohit Ji, It worked, i changed the lengths according to my requirement.
Increased the key length to 21 bytes.
with that i got my output as below.
| Code: |
99665CFU4120101121003 2020-09-23T15:21:16-05:00 #Exception: 41 2020-09-23T15:21:16-05:00
99665CFU4120101121003 2020-09-23T15:21:16-05:00 ------------------------------- 42
99665CFU4120101121003 2020-09-23T15:21:16-05:00 Driver\Event Files Does not exist43
99665CFU4120101121003 2020-09-23T15:21:16-05:00 ------------------------------- 44
20191CWUD520012609111 2020-10-11T15:21:16-05:00 #Exception: 41 2020-10-11T15:21:16-05:00
20191CWUD520012609111 2020-10-11T15:21:16-05:00 ------------------------------- 42
20191CWUD520012609111 2020-10-11T15:21:16-05:00 Driver\Event Files Does not exist43
20191CWUD520012609111 2020-10-11T15:21:16-05:00 ------------------------------- 44
20191CWUD520012609112 2020-10-12T15:21:16-05:00 #Exception: 41 2020-10-12T15:21:16-05:00
20191CWUD520012609112 2020-10-12T15:21:16-05:00 ------------------------------- 42
20191CWUD520012609112 2020-10-12T15:21:16-05:00 Driver\Event Files Does not exist43
20191CWUD520012609112 2020-10-12T15:21:16-05:00 ------------------------------- 44
20191CWUD520012609113 2020-10-13T15:21:16-05:00 #Exception: 41 2020-10-13T15:21:16-05:00
20191CWUD520012609113 2020-10-13T15:21:16-05:00 ------------------------------- 42
20191CWUD520012609113 2020-10-13T15:21:16-05:00 Driver\Event Files Does not exist43
20191CWUD520012609113 2020-10-13T15:21:16-05:00 ------------------------------- 44
20191CWUD520012609114 2020-10-14T15:21:16-05:00 #Exception: 41 2020-10-14T15:21:16-05:00
20191CWUD520012609114 2020-10-14T15:21:16-05:00 ------------------------------- 42
20191CWUD520012609114 2020-10-14T15:21:16-05:00 Driver\Event Files Does not exist43
20191CWUD520012609114 2020-10-14T15:21:16-05:00 ------------------------------- 44 |
i can take out the unwanted data which placed on right side.
Thanks |
|
| Back to top |
|
 |
bshkris
New User
Joined: 21 Mar 2005 Posts: 41 Location: pune
|
|
|
|
Code for above one is
| Code: |
00005 //*******************************************************************
00006 //TEST1 EXEC PGM=SORT
00007 //SORTIN DD DSN=TESTCF.SB033P00.DASHMQEX.CF33T33D.EXCPTN2,DISP=SHR
00008 //SORTOUT DD DSN=TESTCF.SB033P00.DASHMQEX.CF33T33D.EXOUT1,
00009 // DISP=(NEW,CATLG,DELETE),
00010 // SPACE=(CYL,(100,10),RLSE),
00011 // DCB=(MODEL,RECFM=FB,LRECL=200)
00012 //SYSOUT DD SYSOUT=*
00013 //SYSPRINT DD SYSOUT=*
00014 //SYSUDUMP DD SYSOUT=*
00015 //SYSIN DD *
00016 SORT FIELDS=COPY
00017 INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,21),PUSH=(101:24,26)),
00018 IFTHEN=(WHEN=(24,26,CH,EQ,101,26,CH),BUILD=(1,200)),
00019 IFTHEN=(WHEN=(24,1,CH,EQ,C'-'),BUILD=(1,23,101,26,50,36)),
00020 IFTHEN=(WHEN=NONE,BUILD=(1,23,101,26,24,33,83,2))
00021 /*
|
|
|
| Back to top |
|
 |
bshkris
New User
Joined: 21 Mar 2005 Posts: 41 Location: pune
|
|
|
|
Have another change with this same requirements. Trying to cut the description to 2nd line and copying the key values as like below. But instead of coming as 2nd line, it continued on same line. Used '/', it gave syntax error.
| Code: |
//*******************************************************************
//TEST1 EXEC PGM=SORT
//SORTIN DD DSN=TESTCF.SB033P00.DASHMQEX.CF33T33D.EXCPTN2,DISP=SHR
//SORTOUT DD DSN=TESTCF.SB033P00.DASHMQEX.CF33T33D.EXOUT2,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(100,10),RLSE),
// DCB=(MODEL,RECFM=FB,LRECL=200)
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,21),PUSH=(101:24,26,130:57,23)),
IFTHEN=(WHEN=(24,26,CH,EQ,101,26,CH),BUILD=(1,200)),
IFTHEN=(WHEN=(24,1,CH,EQ,C'-'),BUILD=(1,23,101,26,50,36)),
IFTHEN=(WHEN=(57,1,CH,NE,C' '),BUILD=(1,23,101,26,24,33,83,2,
1,23,101,26,57,26,83,2)),
IFTHEN=(WHEN=NONE,BUILD=(1,23,101,26,24,33,83,2))
/* |
I want my output like below,
| Code: |
20274CWU4520030894006 2020-09-30T23:20:28-05:00 #Exception: 41 2020-09-30T23:20:28-05:00 ption:
20274CWU4520030894006 2020-09-30T23:20:28-05:00 ------------------------------- 42
20274CWU4520030894006 2020-09-30T23:20:28-05:00 Invalid provisioning Data - Eithe43
20274CWU4520030894006 2020-09-30T23:20:28-05:00 r Domain/Subdivision/Div 43
20274CWU4520030894006 2020-09-30T23:20:28-05:00 ision/LetterID/TransmissionName/T44
20274CWU4520030894006 2020-09-30T23:20:28-05:00 upleID is incorrect for 44
20274CWU4520030894006 2020-09-30T23:20:28-05:00 the letter id = LGLCPPACK 45
20274CWU4520030894006 2020-09-30T23:20:28-05:00 ------------------------------- 46
99665CFU4120101121003 2020-09-23T15:21:16-05:00 #Exception: 41 2020-09-23T15:21:16-05:00 ption:
99665CFU4120101121003 2020-09-23T15:21:16-05:00 ------------------------------- 42
99665CFU4120101121003 2020-09-23T15:21:16-05:00 Driver\Event Files Does not exist43 |
But I am getting as below:
| Code: |
20274CWU4520030894006 2020-09-30T23:20:28-05:00 #Exception: 41 2020-09-30T23:20:28-05:00 ption:
20274CWU4520030894006 2020-09-30T23:20:28-05:00 ------------------------------- 42
20274CWU4520030894006 2020-09-30T23:20:28-05:00 Invalid provisioning Data - Eithe4320274CWU4520030894006 2020-09-30T23:20:28-05:00 r Domain/Subdivision/Div 43
20274CWU4520030894006 2020-09-30T23:20:28-05:00 ision/LetterID/TransmissionName/T4420274CWU4520030894006 2020-09-30T23:20:28-05:00 upleID is incorrect for 44
20274CWU4520030894006 2020-09-30T23:20:28-05:00 the letter id = LGLCPPACK 45
20274CWU4520030894006 2020-09-30T23:20:28-05:00 ------------------------------- 46
99665CFU4120101121003 2020-09-23T15:21:16-05:00 #Exception: 41 2020-09-23T15:21:16-05:00 ption:
99665CFU4120101121003 2020-09-23T15:21:16-05:00 ------------------------------- 42
99665CFU4120101121003 2020-09-23T15:21:16-05:00 Driver\Event Files Does not exist43 |
Can you plz help me what went wrong.
tried WITH '/' , It gave syntax issue. again used below code..but missing all description data.
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,21),PUSH=(101:24,26,130:57,23)),
IFTHEN=(WHEN=(24,26,CH,EQ,101,26,CH),BUILD=(1,200)),
IFTHEN=(WHEN=(24,1,CH,EQ,C'-'),BUILD=(1,23,101,26,50,36)),
IFTHEN=(WHEN=(57,1,CH,NE,C' '),BUILD=(1,23,101,26,24,33,83,2)),
IFTHEN=(WHEN=(57,1,CH,NE,C' '),BUILD=(1,23,101,26,33,33,83,2)),
IFTHEN=(WHEN=NONE,BUILD=(1,23,101,26,24,33,83,2))
/* |
|
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2272 Location: USA
|
|
|
|
bshkris,
Your continuing questions only prove that you do not want to really understand the ideas given by responders. You just blindly copy-and-paste the provided code with no intention to get into it. Furthermore, there are no intentions to read any manual.
Otherwise you would easily find out the problem with your new “requirement”.
I personally refuse to help to the “experts” like yourself. |
|
| Back to top |
|
 |
bshkris
New User
Joined: 21 Mar 2005 Posts: 41 Location: pune
|
|
|
|
Again sorry. As very rarely i use SORT and i am not expert in that place hence i posted. Let me go thru manuals and fix this. Thanks for motivating me.  |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| Quote: |
| As very rarely i use SORT and i am not expert in that |
In that case you should post your sort questions in the beginners forum - same as I did when I was working. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
| bshkris wrote: |
Again sorry. As very rarely i use SORT and i am not expert in that place hence i posted. Let me go thru manuals and fix this. Thanks for motivating me.  |
When you post something , make sure you post the right input data else we all are wasting our time. You have not once shared the actual input data but claiming out put data should look like this or that. How on earth anyone can predict that?
As suggested please learn Synsort and you have got enough help to get going forward.
Try something relevant by doing research and reading the manuals , post back with error and then some one could help you. This way you could learn. |
|
| Back to top |
|
 |
bshkris
New User
Joined: 21 Mar 2005 Posts: 41 Location: pune
|
|
|
|
Thank you all. Finally i made it by using another step using similar IFTHEN ,WHEN conditions. this time learned some thing new and coming out some fear of SORT JCL code.
Will surely do more experiments, and make myself comfortable using SORT JCL.
Thanks. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2272 Location: USA
|
|
|
|
| bshkris wrote: |
Thank you all. Finally i made it by using another step using similar IFTHEN ,WHEN conditions. this time learned some thing new and coming out some fear of SORT JCL code.
Will surely do more experiments, and make myself comfortable using SORT JCL.
Thanks. |
First of all, you need finally to understand, that SORT code has absolutely nothing to do with JCL code...  |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Sort JCL is really simple. Here is an example:
| Code: |
//TEST1 EXEC PGM=your sort program name/alias
//SORTIN DD DSN=...
//SORTOUT DD DSN=... (no DCB required)
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
sort CONTROL statements go here
/* |
|
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2272 Location: USA
|
|
|
|
The TS might be surprised, but SORT code can be (and often is) used without any JCL code at all...  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|