View previous topic :: View next topic
|
Author |
Message |
Niki
Active User
Joined: 20 Sep 2008 Posts: 106 Location: Bangalore
|
|
|
|
Hi All,
Could you please help me in formatting an input file like below,
I/P - Lrecl = 80, FB
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----
213129999999991234567890123456719AKEY000019901052$1001ABCDE
999addafgd Michele gdhg jg jmg khgm99999923456789012345678 KEY000029900052
9999999asdasd994567890123456789018SKEY000049903052$1283ASAAS$1231GSHSA$9362JSSDS
999999999567asfasff890123456789011DSKEY000059902052$9312FDSFD$4321DXVDA
123456 SAMPLECODE ashje ej
213123 adsf akdja akd kad asdaj
123123 asdwer ergtr hrht
212312 Program1
*-------------
a2sfev sdfsgf sfs sgdsg sff
312344 MICHELE 1nsj34h4jh3jh3j
212312 Program2
a2sfev sdfsgf sfs sgdsg sff
312344 asdas wien qw9iwq33 93nnsjmhb3hb
adasds program3
223awd nnsaffbmam j ma m amn
ad2445 adn b bj3b hw h
242453 Michele 123456577
121344 Michele 323242424
139329 MICHELE 09249jvj9u3j
adasds program-MICHELE
223awd nnsaffbmam j ma m amn
ad2445 adn b bj3b hw h
|
Condition to format the file:
1) Skip the lines until we find the word " SAMPLECODE" starting from 7th character.
2) Search for the word "MICHELE" till end of the file where the 7th character on the line should be Space and should be the first word after 8th position.
3) In the input file the word MICHELE can have in caps or small letter.
The output file is of FB and LRECL = 80.
Here the output we require should populate the line having "MICHELE", when the 7th pos is Space and will be the first in the line after 8th position.
Prior to populating the line MICHELE, It should populate the line where 7th position is SPACE and the 8th position is not equal to SPACE.
And the formating needs to be done as per below sample code,
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----
Program1
MICHELE 1nsj34h4jh3jh3j
program3
Michele 123456577
Michele 323242424
MICHELE 09249jvj9u3j
|
|
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Ok.. but output is having Program1 AND program3? What is the logic for that?
What is the sort product you are using? if it is DFSORT, what is the PTF level?
Refer ibmmainframes.com/viewtopic.php?t=33389 For finding PTF |
|
Back to top |
|
|
Niki
Active User
Joined: 20 Sep 2008 Posts: 106 Location: Bangalore
|
|
|
|
Hi Sambhahi,
Thanks for ur reply.
The output is having Program1 and program3
Logic:
Along with the line Michele, It should populate the prior line where the 7th character is Space and 8th character is not equal to Space.
As per my input the word Michele is present only under Program1 and program3. Hence both the lines are getiing populated.
I am using Z/OS DFSORT V1R12 and having ICE201I H ptf level. |
|
Back to top |
|
|
Niki
Active User
Joined: 20 Sep 2008 Posts: 106 Location: Bangalore
|
|
|
|
Just to add, the word SAMPLECODE can have only once in the input file. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Niki,
Use the following DFSORT JCL which will give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(8,1,SS,NE,C' ,-'),PUSH=(81:8,8))
OUTFIL INCLUDE=(7,2,CH,EQ,C' ',AND,8,72,SS,EQ,C'MICHELE'),
BUILD=(7:7,73,JFY=(SHIFT=LEFT),80:X),REMOVECC,
SECTIONS=(81,8,HEADER3=(81,8))
//* |
|
|
Back to top |
|
|
Niki
Active User
Joined: 20 Sep 2008 Posts: 106 Location: Bangalore
|
|
|
|
Hi Kolusu,
Thanks for your help. |
|
Back to top |
|
|
Goyal
New User
Joined: 16 Mar 2011 Posts: 2 Location: India
|
|
|
|
Can same results be derived from "PARSE" option in DFSORT |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Goyal - why don't you try and see what the result is? |
|
Back to top |
|
|
Goyal
New User
Joined: 16 Mar 2011 Posts: 2 Location: India
|
|
|
|
Hmmmm... |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Goyal wrote: |
Can same results be derived from "PARSE" option in DFSORT |
Goyal,
I would love to see a PARSE solution for this requirement especially when you need the program name from a different record.
Can you enlighten us with your solution? |
|
Back to top |
|
|
|